<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; AHK: CMD StdOut проблемы с кодировкой параметров]]></title>
		<link>https://forum.script-coding.com/viewtopic.php?id=14315</link>
		<atom:link href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=14315&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «AHK: CMD StdOut проблемы с кодировкой параметров».]]></description>
		<lastBuildDate>Sun, 18 Nov 2018 18:23:14 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: AHK: CMD StdOut проблемы с кодировкой параметров]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=129898#p129898</link>
			<description><![CDATA[<p>Пробовал менять руками. Результаты такие, папки все создаются с правильными именами (без кракозябл), а сообщения StdOut тоже правильные.</p>]]></description>
			<author><![CDATA[null@example.com (upsi_daezium)]]></author>
			<pubDate>Sun, 18 Nov 2018 18:23:14 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=129898#p129898</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: CMD StdOut проблемы с кодировкой параметров]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=129879#p129879</link>
			<description><![CDATA[<p>Руками.<br /><span class="postimg"><img src="http://www.fujitsu.com/global/Images/win7_administrative_tab_tcm100-922542.gif" alt="http://www.fujitsu.com/global/Images/win7_administrative_tab_tcm100-922542.gif" /></span></p>]]></description>
			<author><![CDATA[null@example.com (Malcev)]]></author>
			<pubDate>Fri, 16 Nov 2018 20:09:41 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=129879#p129879</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: CMD StdOut проблемы с кодировкой параметров]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=129875#p129875</link>
			<description><![CDATA[<p>Как меняете локаль? Каким скриптом? И что в реестре?</p>]]></description>
			<author><![CDATA[null@example.com (upsi_daezium)]]></author>
			<pubDate>Fri, 16 Nov 2018 17:08:32 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=129875#p129875</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: CMD StdOut проблемы с кодировкой параметров]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=129829#p129829</link>
			<description><![CDATA[<p>А какие подробности вас интересуют?<br />Win7 64 бит Pro английская.<br />Оригинальная сборка.<br />Локаль английская.<br />Файл создаётся с кириллицей, но msgbox от cmd со знаками вопроса.<br />Если сохранять без bom, то создается файл и показывается сообщение с кракозябрами.<br />Если поменять локаль на русскую, то кириллица показывается нормально.</p>]]></description>
			<author><![CDATA[null@example.com (Malcev)]]></author>
			<pubDate>Thu, 15 Nov 2018 16:04:13 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=129829#p129829</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: CMD StdOut проблемы с кодировкой параметров]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=129792#p129792</link>
			<description><![CDATA[<p><strong>Malcev</strong> странно, у меня все заработало. Напишите подробности, я постараюсь проверить.</p>]]></description>
			<author><![CDATA[null@example.com (upsi_daezium)]]></author>
			<pubDate>Wed, 14 Nov 2018 21:03:29 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=129792#p129792</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: CMD StdOut проблемы с кодировкой параметров]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=129769#p129769</link>
			<description><![CDATA[<p>У меня utf-8 with bom не влияет на StdOut.<br />Как были в msgbox знаки вопроса при английской локали, так и остаются.</p>]]></description>
			<author><![CDATA[null@example.com (Malcev)]]></author>
			<pubDate>Tue, 13 Nov 2018 23:25:51 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=129769#p129769</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: CMD StdOut проблемы с кодировкой параметров]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=129768#p129768</link>
			<description><![CDATA[<p>Оказалось, дело было совсем в другом. Напишу здесь, чтобы другие не попали впросак. <br />Все работало, потом вдруг файлы и папки стали появляться с &quot;кракозяблами&quot;, так совпало, что стали писать русские буквы. А у меня редактор для скриптов sublime text 3, я туда пакет поставил editorconfig. И перезаписались настройки сохранения с кодировкой, стало utf-8. А надо то было utf-8 with bom! А обнаружил я это чисто случайно, когда сохранил файл в блокноте и он вдруг сработал как надо.<br />Короче, пацаны, смотрите внимательно и не расслабляйтесь. Всем спасибо. Тред закрыть.</p>]]></description>
			<author><![CDATA[null@example.com (upsi_daezium)]]></author>
			<pubDate>Tue, 13 Nov 2018 22:38:44 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=129768#p129768</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: CMD StdOut проблемы с кодировкой параметров]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=129764#p129764</link>
			<description><![CDATA[<div class="quotebox"><cite>upsi_daezium пишет:</cite><blockquote><p>У вас, вероятно, есть какие-то наработки по этому поводу.</p></blockquote></div><p>У меня нету.<br />Если бы мне захотелось сделать такое через реестр, то я бы сделал снимок реестра, потом поменял бы локаль, отрестартился бы и сделал еще раз снимок реестра и сравнил бы их.<br />Уверен, что там еще добавляются/меняются шрифты.<br />А вообще можно менять через запуская нужный xml через intl.cpl.</p>]]></description>
			<author><![CDATA[null@example.com (Malcev)]]></author>
			<pubDate>Tue, 13 Nov 2018 18:24:54 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=129764#p129764</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: CMD StdOut проблемы с кодировкой параметров]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=129757#p129757</link>
			<description><![CDATA[<div class="quotebox"><cite>stealzy пишет:</cite><blockquote><p>Run %comspec% /c mkdir C:\вышобобо,, Hide</p></blockquote></div><p>Кстати, совсем забыл вам ответить, что и эта команда делает папку с неправильной кодировкой.</p>]]></description>
			<author><![CDATA[null@example.com (upsi_daezium)]]></author>
			<pubDate>Tue, 13 Nov 2018 17:13:30 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=129757#p129757</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: CMD StdOut проблемы с кодировкой параметров]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=129756#p129756</link>
			<description><![CDATA[<p>Хорошо, <strong>Malcev</strong>, давайте посмотрим в эту сторону. Я тут поискал немного и вот что нашел:<br /></p><div class="codebox"><pre><code>
Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage
</code></pre></div><p>Это ветвь реестра, где, видимо, и хранятся эти параметры. Если я правильно понял, это это ACP, OEMCP (у меня соотвтсвенно значения 1251 и 866).<br />У вас, вероятно, есть какие-то наработки по этому поводу.</p>]]></description>
			<author><![CDATA[null@example.com (upsi_daezium)]]></author>
			<pubDate>Tue, 13 Nov 2018 16:59:52 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=129756#p129756</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: CMD StdOut проблемы с кодировкой параметров]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=129752#p129752</link>
			<description><![CDATA[<div class="quotebox"><cite>upsi_daezium пишет:</cite><blockquote><p>Malcev насчет реестра не уверен, что надо туда лезть.</p></blockquote></div><p>А что по вашему делает смена локали, да и любые другие настройки виндовс?<br />Я на всех машинах всегда ставлю русскую локаль - никогда проблем не было.<br />ИМХО сейчас вы здесь будете использовать костыли, а потом знаки вопроса/кракозябры появятся в другой программе не поддерживающей юникод.</p>]]></description>
			<author><![CDATA[null@example.com (Malcev)]]></author>
			<pubDate>Tue, 13 Nov 2018 16:08:12 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=129752#p129752</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: CMD StdOut проблемы с кодировкой параметров]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=129750#p129750</link>
			<description><![CDATA[<p><strong>teadrinker</strong> так, а у вас какая система\версия\локаль??<br /><strong>Malcev</strong> насчет реестра не уверен, что надо туда лезть.</p><p>Путем копания забугорных форумов, нашел один участок кода, применил методом тыка и вот что получилось:<br /></p><div class="codebox"><pre><code>
s := &quot;__тест_test&quot; ; __С‚РµСЃС‚_test

vText := s ; вот, собственно, этот код
vSize := StrPut(vText, &quot;CP1251&quot;) ; с указанием этой кодировки все работает
VarSetCapacity(vTemp, vSize)
StrPut(vText, &amp;vTemp, &quot;CP1251&quot;) ; и тут
s := StrGet(&amp;vTemp, &quot;UTF-8&quot;) ; а здесь уже ЮТФ-8 нужно указать
MsgBox, % s ; ok

MsgBox, % StdOut(&quot;cmd.exe /u /q /c mkdir &quot;&quot;C:\temp\&quot; . s . s . &quot;&quot;&quot; &quot;, &quot;&quot;) ; now ok
MsgBox, % StdOut(&quot;cmd.exe /a /q /c mkdir &quot;&quot;C:\temp\&quot; . s . &quot;&quot;&quot; &quot;, &quot;cp866&quot;) ; now ok
MsgBox, % StdOut(&quot;cmd.exe /a /q /c dir &quot;&quot;C:\temp\&quot;&quot; &quot;, &quot;cp866&quot;) ; cool


StdOut(sCmd, encoding)
{
   static STARTF_USESTDHANDLES := 0x100, CREATE_NO_WINDOW := 0x08000000

   DllCall(&quot;CreatePipe&quot;, PtrP, hStdInRd, PtrP, hStdInWr, UInt, 0, UInt, 0)
   DllCall(&quot;CreatePipe&quot;, PtrP, hStdOutRd, PtrP, hStdOutWr, UInt, 0, UInt, 0)
   DllCall(&quot;SetHandleInformation&quot;, Ptr, hStdInRd, UInt, 1, UInt, 1)
   DllCall(&quot;SetHandleInformation&quot;, Ptr, hStdOutWr, UInt, 1, UInt, 1)

   VarSetCapacity(pi, A_PtrSize*2 + 8, 0)
   NumPut( VarSetCapacity(      si, A_PtrSize*4 + 4*8 + A_PtrSize*5, 0), si )
   NumPut(STARTF_USESTDHANDLES, si, A_PtrSize*4 + 4*7)
   NumPut(hStdInRd            , si, A_PtrSize*4 + 4*8 + A_PtrSize*2)
   NumPut(hStdOutWr           , si, A_PtrSize*4 + 4*8 + A_PtrSize*3)
   NumPut(hStdOutWr           , si, A_PtrSize*4 + 4*8 + A_PtrSize*4)

   DllCall(&quot;CreateProcess&quot;, UInt, 0, Ptr, &amp;sCmd, UInt, 0, UInt, 0, Int, True, UInt, CREATE_NO_WINDOW, UInt, 0, UInt, 0, Ptr, &amp;si, Ptr, &amp;pi)

   for k, v in [NumGet(pi, 0), NumGet(pi, A_PtrSize), hStdOutWr, hStdInRd, hStdInWr]
      DllCall(&quot;CloseHandle&quot;, Ptr, v)

   VarSetCapacity(sTemp, 4095)
   while DllCall(&quot;ReadFile&quot;, UInt, hStdOutRd, Ptr, &amp;sTemp, UInt, 4095, UIntP, nSize, UInt, 0)
      sOutput .= StrGet(&amp;sTemp, nSize, encoding)
   DllCall(&quot;CloseHandle&quot;, Ptr, hStdOutRd)
   Return sOutput
}
</code></pre></div><p>Просьба проверить как у вас работает и, если кто разберется, написать как это конкретно работает.</p>]]></description>
			<author><![CDATA[null@example.com (upsi_daezium)]]></author>
			<pubDate>Tue, 13 Nov 2018 15:45:48 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=129750#p129750</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: CMD StdOut проблемы с кодировкой параметров]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=129748#p129748</link>
			<description><![CDATA[<div class="quotebox"><cite>upsi_daezium пишет:</cite><blockquote><p>Спасибо, но можно это сделать средствами ahk?</p></blockquote></div><p>Конечно можно. <br />Посмотрите, что меняется в реестре при изменении локали и повторите тоже самое.</p>]]></description>
			<author><![CDATA[null@example.com (Malcev)]]></author>
			<pubDate>Tue, 13 Nov 2018 15:21:06 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=129748#p129748</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: CMD StdOut проблемы с кодировкой параметров]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=129746#p129746</link>
			<description><![CDATA[<p>Да, и на 7, и на 10, в любом варианте:<br /></p><div class="codebox"><pre><code>s := &quot;__тест_test&quot;

MsgBox, % StdOut(&quot;cmd.exe /u /q /c mkdir &quot;&quot;C:\temp\&quot; . s . &quot;&quot;&quot; &quot;, &quot;cp866&quot;) ; not work
MsgBox, % StdOut(&quot;cmd.exe /a /q /c mkdir &quot;&quot;C:\temp\&quot; . s . &quot;&quot;&quot; &quot;, &quot;cp866&quot;) ; not work</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Tue, 13 Nov 2018 14:57:52 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=129746#p129746</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: CMD StdOut проблемы с кодировкой параметров]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=129743#p129743</link>
			<description><![CDATA[<p><strong>teadrinker</strong> sad. Вы говорили, что у вас все сразу работает, создается папка с правильным именем?</p>]]></description>
			<author><![CDATA[null@example.com (upsi_daezium)]]></author>
			<pubDate>Tue, 13 Nov 2018 14:51:36 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=129743#p129743</guid>
		</item>
	</channel>
</rss>
