<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: CMD StdOut проблемы с кодировкой параметров]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=14315&amp;type=atom" />
	<updated>2018-11-18T18:23:14Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=14315</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: CMD StdOut проблемы с кодировкой параметров]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=129898#p129898" />
			<content type="html"><![CDATA[<p>Пробовал менять руками. Результаты такие, папки все создаются с правильными именами (без кракозябл), а сообщения StdOut тоже правильные.</p>]]></content>
			<author>
				<name><![CDATA[upsi_daezium]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34120</uri>
			</author>
			<updated>2018-11-18T18:23:14Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=129898#p129898</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: CMD StdOut проблемы с кодировкой параметров]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=129879#p129879" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2018-11-16T20:09:41Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=129879#p129879</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: CMD StdOut проблемы с кодировкой параметров]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=129875#p129875" />
			<content type="html"><![CDATA[<p>Как меняете локаль? Каким скриптом? И что в реестре?</p>]]></content>
			<author>
				<name><![CDATA[upsi_daezium]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34120</uri>
			</author>
			<updated>2018-11-16T17:08:32Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=129875#p129875</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: CMD StdOut проблемы с кодировкой параметров]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=129829#p129829" />
			<content type="html"><![CDATA[<p>А какие подробности вас интересуют?<br />Win7 64 бит Pro английская.<br />Оригинальная сборка.<br />Локаль английская.<br />Файл создаётся с кириллицей, но msgbox от cmd со знаками вопроса.<br />Если сохранять без bom, то создается файл и показывается сообщение с кракозябрами.<br />Если поменять локаль на русскую, то кириллица показывается нормально.</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2018-11-15T16:04:13Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=129829#p129829</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: CMD StdOut проблемы с кодировкой параметров]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=129792#p129792" />
			<content type="html"><![CDATA[<p><strong>Malcev</strong> странно, у меня все заработало. Напишите подробности, я постараюсь проверить.</p>]]></content>
			<author>
				<name><![CDATA[upsi_daezium]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34120</uri>
			</author>
			<updated>2018-11-14T21:03:29Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=129792#p129792</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: CMD StdOut проблемы с кодировкой параметров]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=129769#p129769" />
			<content type="html"><![CDATA[<p>У меня utf-8 with bom не влияет на StdOut.<br />Как были в msgbox знаки вопроса при английской локали, так и остаются.</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2018-11-13T23:25:51Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=129769#p129769</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: CMD StdOut проблемы с кодировкой параметров]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=129768#p129768" />
			<content type="html"><![CDATA[<p>Оказалось, дело было совсем в другом. Напишу здесь, чтобы другие не попали впросак. <br />Все работало, потом вдруг файлы и папки стали появляться с &quot;кракозяблами&quot;, так совпало, что стали писать русские буквы. А у меня редактор для скриптов sublime text 3, я туда пакет поставил editorconfig. И перезаписались настройки сохранения с кодировкой, стало utf-8. А надо то было utf-8 with bom! А обнаружил я это чисто случайно, когда сохранил файл в блокноте и он вдруг сработал как надо.<br />Короче, пацаны, смотрите внимательно и не расслабляйтесь. Всем спасибо. Тред закрыть.</p>]]></content>
			<author>
				<name><![CDATA[upsi_daezium]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34120</uri>
			</author>
			<updated>2018-11-13T22:38:44Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=129768#p129768</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: CMD StdOut проблемы с кодировкой параметров]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=129764#p129764" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>upsi_daezium пишет:</cite><blockquote><p>У вас, вероятно, есть какие-то наработки по этому поводу.</p></blockquote></div><p>У меня нету.<br />Если бы мне захотелось сделать такое через реестр, то я бы сделал снимок реестра, потом поменял бы локаль, отрестартился бы и сделал еще раз снимок реестра и сравнил бы их.<br />Уверен, что там еще добавляются/меняются шрифты.<br />А вообще можно менять через запуская нужный xml через intl.cpl.</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2018-11-13T18:24:54Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=129764#p129764</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: CMD StdOut проблемы с кодировкой параметров]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=129757#p129757" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>stealzy пишет:</cite><blockquote><p>Run %comspec% /c mkdir C:\вышобобо,, Hide</p></blockquote></div><p>Кстати, совсем забыл вам ответить, что и эта команда делает папку с неправильной кодировкой.</p>]]></content>
			<author>
				<name><![CDATA[upsi_daezium]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34120</uri>
			</author>
			<updated>2018-11-13T17:13:30Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=129757#p129757</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: CMD StdOut проблемы с кодировкой параметров]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=129756#p129756" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[upsi_daezium]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34120</uri>
			</author>
			<updated>2018-11-13T16:59:52Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=129756#p129756</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: CMD StdOut проблемы с кодировкой параметров]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=129752#p129752" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>upsi_daezium пишет:</cite><blockquote><p>Malcev насчет реестра не уверен, что надо туда лезть.</p></blockquote></div><p>А что по вашему делает смена локали, да и любые другие настройки виндовс?<br />Я на всех машинах всегда ставлю русскую локаль - никогда проблем не было.<br />ИМХО сейчас вы здесь будете использовать костыли, а потом знаки вопроса/кракозябры появятся в другой программе не поддерживающей юникод.</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2018-11-13T16:08:12Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=129752#p129752</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: CMD StdOut проблемы с кодировкой параметров]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=129750#p129750" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[upsi_daezium]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34120</uri>
			</author>
			<updated>2018-11-13T15:45:48Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=129750#p129750</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: CMD StdOut проблемы с кодировкой параметров]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=129748#p129748" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>upsi_daezium пишет:</cite><blockquote><p>Спасибо, но можно это сделать средствами ahk?</p></blockquote></div><p>Конечно можно. <br />Посмотрите, что меняется в реестре при изменении локали и повторите тоже самое.</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2018-11-13T15:21:06Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=129748#p129748</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: CMD StdOut проблемы с кодировкой параметров]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=129746#p129746" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2018-11-13T14:57:52Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=129746#p129746</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: CMD StdOut проблемы с кодировкой параметров]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=129743#p129743" />
			<content type="html"><![CDATA[<p><strong>teadrinker</strong> sad. Вы говорили, что у вас все сразу работает, создается папка с правильным именем?</p>]]></content>
			<author>
				<name><![CDATA[upsi_daezium]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34120</uri>
			</author>
			<updated>2018-11-13T14:51:36Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=129743#p129743</id>
		</entry>
</feed>
