Культурный офтопик
 help / color / mirror / Atom feed
From: Sergey Korobitsin <undertaker@arta.kz>
To: smoke-room@lists.altlinux.org
Subject: Re: [room] Как найти файл в определённой кодировке?
Date: Wed, 24 Aug 2011 17:43:25 +0600
Message-ID: <20110824114325.GP2067@undertaker.dev.lan.arta.kz> (raw)
In-Reply-To: <CADbnjxH7g_=43uGjFvm--vAQvLSQd5KVGyy+hfGXE_LmjdH42A@mail.gmail.com>

Денис Черносов ☫ → To Культурный офтопик @ Wed, Aug 24, 2011 14:04 +0400

> Поэкспериментировал...
> 1) вроде бы recode действительно не перекодирует лишнего, но
> 2) преобразование виндовых разделителей в юниксовые он делать не умеет и
> вообще не перекодирует такие файлы:
> 
> recode: failed: Ambiguous output in step `CR-LF..data'
> 
> Зато iconv их нормально отрабатывает. Но iconv точно пытается перекодироват
> файлы, которые уже в юникоде и вылетает по ошибке:
> 
> iconv: недопустимая входная последовательность в позиции 1099
> 
> Так что вижу выход рекурсивного прохода каталога с помощью recode и второго
> прохода файлов, на которых он споткнулся с помощью iconv.

Можно сделать в три этапа:
1. Прогоняем каталоги dos2unix (или аналогичной штукой, tr например)
   Результат: имеем все файлы в UNIX-кодировке

2. Натравливаем на готовые файлы. В идеале оно должно пройти без ошибок.
   Если ошибки всё-таки есть, то смотрим, что произошло и при
   необходимости натравливаем iconv

> Спасибо всем за участие! Особенно тебе, земляк. ;)

Пожалуйста! Меня тоже напрягают файлы не в unicode и не в
unix-line-endings. При попытке работать с такими с помощью while; read,
awk, да почти всеми текстовыми утилитами, начинается такая катавасия,
что боже упаси.

-- 
Bright regards, Sergey Korobitsin,
Chief Research Officer
Arta Software, http://arta.kz/
xmpp:undertaker@jabber.arta.kz

--
Пифагоровы штаны Лобачевскому смешны
 -- <lj user=osd>


      parent reply	other threads:[~2011-08-24 11:43 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-22 11:06 ` Alexei V. Mezin
2011-08-24 10:09     ` Alexei V. Mezin
2011-08-22 11:53 ` Sergey Korobitsin
2011-08-24 10:14     ` Alexei V. Mezin
2011-08-24 10:23       ` Andrew Borodin
2011-08-25 20:18         ` Aleksey Avdeev
2011-08-24 10:19     ` Aleksey Avdeev
2011-08-24 11:43     ` Sergey Korobitsin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110824114325.GP2067@undertaker.dev.lan.arta.kz \
    --to=undertaker@arta.kz \
    --cc=smoke-room@lists.altlinux.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Культурный офтопик

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/smoke-room/0 smoke-room/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 smoke-room smoke-room/ http://lore.altlinux.org/smoke-room \
		smoke-room@lists.altlinux.org smoke-room@lists.altlinux.ru smoke-room@lists.altlinux.com smoke-room@altlinux.ru smoke-room@altlinux.org smoke-room@altlinux.com
	public-inbox-index smoke-room

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.smoke-room


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git