<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Linux Forum &mdash; *.php из cp1251 в utf8 рекурсивно]]></title>
	<link rel="self" href="https://linuxforum.ru/extern.php?action=feed&amp;tid=19603&amp;type=atom" />
	<updated>2012-01-19T00:25:26Z</updated>
	<generator>PunBB</generator>
	<id>https://linuxforum.ru/viewtopic.php?id=19603</id>
		<entry>
			<title type="html"><![CDATA[Re: *.php из cp1251 в utf8 рекурсивно]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=244164#p244164" />
			<content type="html"><![CDATA[<p><div class="termtitle" style="font-family: sans-serif; position:relative; height:auto; width:auto; background:#3A4061; color:#FFFFFF; padding: 1px;"><b> Консоль:</b></div>
<div class="termcont" style="font-family: Terminus; position:relative; height:auto; width:auto; overflow-x:scroll; white-space: nowrap ; overflow-y:auto;background:#000000; color:#4EF44E; line-height:1.2; padding: 3px; font-size: 1rem; max-height: 60vh">doc@dt:~/cp$ iconv --help<br />Использование: iconv [КЛЮЧ...] [ФАЙЛ...]<br />Преобразует указанные файлы из одной<br />кодировки в другую.</p><p> Спецификация формата ввода/вывода:<br />&nbsp; -f, --from-code=ФАЙЛ&nbsp; &nbsp;кодировка оригинального<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;текста<br />&nbsp; -t, --to-code=ФАЙЛ&nbsp; &nbsp; &nbsp;кодировка для вывода</p><p> Информация:<br />&nbsp; -l, --list&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;перечислить все известные<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;встроенные кодировки</p><p> Усправление выводом:<br />&nbsp; -c&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;пропускать на выводе<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;недопустимые знаки<br />&nbsp; -o, --output=FILE&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; выходной файл<br />&nbsp; -s, --silent&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;не печатать предупреждения<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; --verbose&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; печатать информацию о ходе<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;работы</p><p>&nbsp; -?, --help&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Выдает этот справочный<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;список<br />&nbsp; &nbsp; &nbsp; --usage&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Выдает краткую информацию<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;об использовании<br />&nbsp; -V, --version&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Печатает версию программы</p><p>Обязательные или необязательные аргументы<br />для длинных ключей также являются<br />обязательными или необязательными для<br />соответствующих коротких ключей.</p><p>Инструкции по сообщению об ошибках<br />смотрите на<br />&lt;<a href="http://www.gnu.org/software/libc/bugs.html">http://www.gnu.org/software/libc/bugs.html</a>&gt;.<br /></div></p>]]></content>
			<author>
				<name><![CDATA[drBatty]]></name>
				<uri>https://linuxforum.ru/profile.php?id=86</uri>
			</author>
			<updated>2012-01-19T00:25:26Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=244164#p244164</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: *.php из cp1251 в utf8 рекурсивно]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=244014#p244014" />
			<content type="html"><![CDATA[<p>скрипт на некоторых файлах выдает:<br /></p><div class="codebox"><pre><code>iconv: illegal input sequence at position *** (iconv: недопустимая входная последовательность в позиции ***)</code></pre></div><p>Как с этим справиться?</p>]]></content>
			<author>
				<name><![CDATA[h0lder]]></name>
				<uri>https://linuxforum.ru/profile.php?id=9341</uri>
			</author>
			<updated>2012-01-18T13:44:08Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=244014#p244014</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: *.php из cp1251 в utf8 рекурсивно]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=243928#p243928" />
			<content type="html"><![CDATA[<p>вот это я дал...<br />все уже давно работает</p><p>в тестовых файлах не было русских букв, поэтому и не конвертировало в utf8</p>]]></content>
			<author>
				<name><![CDATA[h0lder]]></name>
				<uri>https://linuxforum.ru/profile.php?id=9341</uri>
			</author>
			<updated>2012-01-18T09:57:20Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=243928#p243928</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: *.php из cp1251 в utf8 рекурсивно]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=243923#p243923" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>h0lder пишет:</cite><blockquote><p>Создает рядом с файлом file.php новый файл file.php~<br />Но file.php~ по прежнему в cp1251</p></blockquote></div><p>тот что с ~ - это не новый, а <strong>старый файл</strong>. Сохраняется в целях бекапа. Если не нравится - уберите ключ <strong>--backup</strong>, но это не надёжно...</p>]]></content>
			<author>
				<name><![CDATA[drBatty]]></name>
				<uri>https://linuxforum.ru/profile.php?id=86</uri>
			</author>
			<updated>2012-01-18T09:31:40Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=243923#p243923</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: *.php из cp1251 в utf8 рекурсивно]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=243917#p243917" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>drBatty пишет:</cite><blockquote><div class="quotebox"><cite>h0lder пишет:</cite><blockquote><p>Пытаюсь в заданной папке и всех ее подпапках преобразовать файлы php (и PHP) из cp1251 в utf8</p></blockquote></div><p>проще скрипт написать, что-то типа(не проверил!) :</p><div class="codebox"><pre><code>#!/bin/sh
TMP=`mktemp`
if file &quot;$1&quot; | grep -q &#039;UTF-8&#039;; then
  echo &quot;$1 уже перекодирован&quot;
else
  iconv -f cp1251 $1 &gt;$TMP || exit
  mv --backup &quot;$TMP&quot; &quot;$1&quot; || exit
fi</code></pre></div><p>и вперёд<br /><div class="termtitle" style="font-family: sans-serif; position:relative; height:auto; width:auto; background:#3A4061; color:#FFFFFF; padding: 1px;"><b> Консоль:</b></div>
<div class="termcont" style="font-family: Terminus; position:relative; height:auto; width:auto; overflow-x:scroll; white-space: nowrap ; overflow-y:auto;background:#000000; color:#4EF44E; line-height:1.2; padding: 3px; font-size: 1rem; max-height: 60vh">find . -name &quot;*.php&quot; -exec ./convert1251toutf-8.sh {} \;</div></p></blockquote></div><p>Создает рядом с файлом file.php новый файл file.php~<br />Но file.php~ по прежнему в cp1251</p><p>Файлы в UTF-8 не трогает, написав &quot;уже перекодирован&quot;. Тут все ОК.</p>]]></content>
			<author>
				<name><![CDATA[h0lder]]></name>
				<uri>https://linuxforum.ru/profile.php?id=9341</uri>
			</author>
			<updated>2012-01-18T09:08:32Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=243917#p243917</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: *.php из cp1251 в utf8 рекурсивно]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=243854#p243854" />
			<content type="html"><![CDATA[<p><strong>h0lder</strong>, попробуйте вместо <em>enconv</em> использовать <a href="http://gitorious.org/enca">enca</a> — она с кодировками, IMHO, более корректно обращается, лишний раз не перекодирует.</p>]]></content>
			<author>
				<name><![CDATA[Lupo Alberto]]></name>
				<uri>https://linuxforum.ru/profile.php?id=9018</uri>
			</author>
			<updated>2012-01-17T21:37:00Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=243854#p243854</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: *.php из cp1251 в utf8 рекурсивно]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=243853#p243853" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>h0lder пишет:</cite><blockquote><p>Пытаюсь в заданной папке и всех ее подпапках преобразовать файлы php (и PHP) из cp1251 в utf8</p></blockquote></div><p>проще скрипт написать, что-то типа(не проверил!) :</p><div class="codebox"><pre><code>#!/bin/sh
TMP=`mktemp`
if file &quot;$1&quot; | grep -q &#039;UTF-8&#039;; then
  echo &quot;$1 уже перекодирован&quot;
else
  iconv -f cp1251 $1 &gt;$TMP || exit
  mv --backup &quot;$TMP&quot; &quot;$1&quot; || exit
fi</code></pre></div><p>и вперёд<br /><div class="termtitle" style="font-family: sans-serif; position:relative; height:auto; width:auto; background:#3A4061; color:#FFFFFF; padding: 1px;"><b> Консоль:</b></div>
<div class="termcont" style="font-family: Terminus; position:relative; height:auto; width:auto; overflow-x:scroll; white-space: nowrap ; overflow-y:auto;background:#000000; color:#4EF44E; line-height:1.2; padding: 3px; font-size: 1rem; max-height: 60vh">find . -name &quot;*.php&quot; -exec ./convert1251toutf-8.sh {} \;</div></p>]]></content>
			<author>
				<name><![CDATA[drBatty]]></name>
				<uri>https://linuxforum.ru/profile.php?id=86</uri>
			</author>
			<updated>2012-01-17T21:32:07Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=243853#p243853</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[*.php из cp1251 в utf8 рекурсивно]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=243836#p243836" />
			<content type="html"><![CDATA[<p>Пытаюсь в заданной папке и всех ее подпапках преобразовать файлы php (и PHP) из cp1251 в utf8</p><p>Пробовал такие команды:<br />find /папка -name &quot;*.php&quot; -exec enconv -x UTF8 {} \;<br />find /папка -iname &quot;*\.php&quot; -exec enconv {} \;<br />find /папка -name &quot;*.php&quot; -exec enconv {} \;<br />find /папка -name &quot;*.php&quot; |enconv<br />find /папка -name &quot;*.php&quot; |enconv -x UTF-8<br />не конвертирует.</p><p>а вот эта:<br />find /папка -type f -iname &quot;*\.php&quot; -exec recode -f cp1251..utf8 {} \;<br />портит файлы, которые уже в кодировке UTF-8</p><p>Помогите пожалуйста.</p>]]></content>
			<author>
				<name><![CDATA[h0lder]]></name>
				<uri>https://linuxforum.ru/profile.php?id=9341</uri>
			</author>
			<updated>2012-01-17T18:38:16Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=243836#p243836</id>
		</entry>
</feed>
