<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; AHK: Смена кодировки текста в переменной]]></title>
		<link>https://forum.script-coding.com/viewtopic.php?id=10446</link>
		<atom:link href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=10446&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «AHK: Смена кодировки текста в переменной».]]></description>
		<lastBuildDate>Tue, 24 Feb 2015 08:43:10 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: AHK: Смена кодировки текста в переменной]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=91884#p91884</link>
			<description><![CDATA[<p>В Юникоде код символа — это два байта, т.е. в хексе будет 4 символа. С поправкой на это, вроде всё работает.<br /></p><div class="codebox"><pre><code>
StrToHex = Привет Мир!

StrtoHex:
SetFormat, Integer, H
CodeString =
Loop, Parse, StrToHex
{
  CharCode := Asc(A_LoopField)
  CodeString .= SubStr(&quot;000&quot; . SubStr(CharCode, 3), -3)
}
StringUpper, CodeString, CodeString
MsgBox %CodeString%



HextoStr:
HextoStr = %CodeString%
Text =
Pos = 1
Loop, % StrLen(HextoStr) // 4
{
  CharCode := &quot;0x&quot; . SubStr(HextoStr, Pos, 4)
  Text .= Chr(CharCode)
  Pos += 4
}
MsgBox %Text%
return
</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (YMP)]]></author>
			<pubDate>Tue, 24 Feb 2015 08:43:10 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=91884#p91884</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Смена кодировки текста в переменной]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=91882#p91882</link>
			<description><![CDATA[<p>Может и в UTF-16.<br />Я&nbsp; не особо понимаю как эти функции использовать: StrGet и StrPut.<br />Проблема возникает в этом скрипте, который переводит строку в HEX и обратно HEX в строку.<br />Раньше на версии AutoHotkey ANSI все работало отлично, а теперь на выходе бяки.<br /></p><div class="codebox"><pre><code>StrToHex = Привет Мир!

StrtoHex:
SetFormat, Integer, H
CodeString =
Loop, Parse, StrToHex
{
  CharCode := Asc(A_LoopField)
  If CharCode &lt; 0x10
    CodeString .= &quot;0&quot; . SubStr(CharCode, 3)
  Else
    CodeString .= SubStr(CharCode, 3)
}
StringUpper, CodeString, CodeString
MsgBox %CodeString%



HextoStr:
HextoStr = %CodeString%
Text =
Pos = 1
Loop, % StrLen(HextoStr) / 2
{
  CharCode := &quot;0x&quot; . SubStr(HextoStr, Pos, 2)
  Text .= Chr(CharCode)
  Pos += 2
}
MsgBox %Text%
return</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (avens)]]></author>
			<pubDate>Tue, 24 Feb 2015 08:12:04 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=91882#p91882</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Смена кодировки текста в переменной]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=91869#p91869</link>
			<description><![CDATA[<p>А вы уверены, что он там именно в UTF-8? Родная кодировка для строк в юникодном АНК —&nbsp; UTF-16. Но если таки да, т.е. переменная используется просто как буфер, то сначала прочитать StrGet как UTF-8, потом записать StrPut как ANSI. Или наоборот.</p><p>Учесть размер буфера, чтобы не вылезти за его пределы (во втором случае).</p>]]></description>
			<author><![CDATA[null@example.com (YMP)]]></author>
			<pubDate>Mon, 23 Feb 2015 18:34:43 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=91869#p91869</guid>
		</item>
		<item>
			<title><![CDATA[AHK: Смена кодировки текста в переменной]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=91861#p91861</link>
			<description><![CDATA[<p>Необходимо сменить кодировку текста в переменной с UTF-8 в ANSI и обратно.<br />Как это делается?<br />Рабочая версия AutoHotkey Unicode</p>]]></description>
			<author><![CDATA[null@example.com (avens)]]></author>
			<pubDate>Mon, 23 Feb 2015 17:22:24 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=91861#p91861</guid>
		</item>
	</channel>
</rss>
