<?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>http://forum.script-coding.com/viewtopic.php?id=12346</link>
		<atom:link href="http://forum.script-coding.com/extern.php?action=feed&amp;tid=12346&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «AHK: Замена в тексте английских символов на русские».]]></description>
		<lastBuildDate>Sun, 22 Jan 2017 17:14:13 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: AHK: Замена в тексте английских символов на русские]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=111416#p111416</link>
			<description><![CDATA[<p>Спасибо, все работает.</p>]]></description>
			<author><![CDATA[null@example.com (Dworkin)]]></author>
			<pubDate>Sun, 22 Jan 2017 17:14:13 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=111416#p111416</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Замена в тексте английских символов на русские]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=111395#p111395</link>
			<description><![CDATA[<p>В массиве ключ &quot;A&quot; и &quot;a&quot; одно и тоже.<br /></p><div class="codebox"><pre><code>
#NoEnv
#SingleInstance Force
StringCaseSense, On

oEng := [&quot;A&quot;,&quot;a&quot;,&quot;E&quot;,&quot;e&quot;,&quot;T&quot;,&quot;O&quot;,&quot;o&quot;,&quot;P&quot;,&quot;p&quot;,&quot;H&quot;,&quot;K&quot;,&quot;k&quot;,&quot;X&quot;,&quot;x&quot;,&quot;C&quot;,&quot;c&quot;,&quot;B&quot;,&quot;M&quot;]
oRUS := [&quot;А&quot;,&quot;а&quot;,&quot;Е&quot;,&quot;е&quot;,&quot;Т&quot;,&quot;О&quot;,&quot;о&quot;,&quot;Р&quot;,&quot;р&quot;,&quot;Н&quot;,&quot;К&quot;,&quot;к&quot;,&quot;Х&quot;,&quot;х&quot;,&quot;С&quot;,&quot;с&quot;,&quot;В&quot;,&quot;М&quot;] 

rus := &quot;Растение&quot; ; Слово полностью написано русскими символами
eng := &quot;Pacтeниe&quot; ; Тут буквы &quot;P&quot;, &quot;a&quot;, &quot;c&quot; два &quot;е&quot; написаны анлийскими символами
; Если просто читать то слова одинаковы, но в хексе разные
rush := StringToHex(rus)
engh := StringToHex(eng)
msgbox, rus: %rus%`nHEX rus: %rush%`neng: %eng%`nHEX eng: %engh% ; показывает в хексе символы
 
For k, v in oEng
	StringReplace, eng, eng, % v, % oRUS[k], All 

engh := StringToHex(eng)
msgbox, rus: %rus%`nHEX rus: %rush%`neng: %eng%`nHEX eng: %engh%
; видно что заменятся и хекс одинаковый, кроме первой буквы. Первая буква становится маленькой

StringToHex(String)
	{
	local Old_A_FormatInteger, CharHex, HexString
	
	;Return &#039;0&#039; if the string was blank
	If !String
		Return 0
	
	;Save the current Integer format
	Old_A_FormatInteger := A_FormatInteger
	
	;Set the format of integers to their Hex value
	SetFormat, INTEGER, H
	
	;Parse the String
	Loop, Parse, String 
		{
		;Get the ASCII value of the Character (will be converted to the Hex value by the SetFormat Line above)
		CharHex := Asc(A_LoopField)
	
		;Comment out the following line to leave the &#039;0x&#039; intact
		StringTrimLeft, CharHex, CharHex, 2
		
		;Build the return string
		HexString .= CharHex . &quot; &quot;
		}
	;Set the integer format to what is was prior to the call
	SetFormat, INTEGER, %Old_A_FormatInteger%
	
	;Return the string to the caller
	Return HexString
	}
</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (serzh82saratov)]]></author>
			<pubDate>Sun, 22 Jan 2017 08:32:56 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=111395#p111395</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Замена в тексте английских символов на русские]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=111392#p111392</link>
			<description><![CDATA[<p>Не понимаю, вставил учет регистра и все равно большую заменяет на маленькую.<br /></p><div class="codebox"><pre><code>StringCaseSense, on</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Dworkin)]]></author>
			<pubDate>Sun, 22 Jan 2017 08:11:29 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=111392#p111392</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Замена в тексте английских символов на русские]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=111387#p111387</link>
			<description><![CDATA[<p><span style="color: green"><strong>Dworkin</strong><br />Отредактируйте заголовок, добавьте отсутствующие точки.</span></p><p><span style="color: green"><strong>Принято</strong>. Заголовок приближен к ТЗ.</span></p>]]></description>
			<author><![CDATA[null@example.com (Flasher)]]></author>
			<pubDate>Sun, 22 Jan 2017 07:05:00 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=111387#p111387</guid>
		</item>
		<item>
			<title><![CDATA[AHK: Замена в тексте английских символов на русские]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=111386#p111386</link>
			<description><![CDATA[<p>Помогите пожалуйста.<br />Нашел как заменять английские символы на русские, НО происходит какой-то баг.<br />Заменяет все символы хорошо, кроме первого большого символа, он ее заменяет на маленькую русскую букву почему-то. Короче заменяет все большие символы на маленькие.<br />В HEX&#039;e:<br />английская P = 50 <br />английская p = 70<br />русская P = D0<br />русская p = F0<br />То есть по хексу первая буква была 50(БОЛЬШАЯ англ P), а стала после замены F0(маленькая рус Р).</p><p>То есть:<br /></p><div class="codebox"><pre><code>
rus := &quot;Растение&quot; ; Слово полностью написано русскими символами
eng := &quot;Pacтeниe&quot; ; Тут буквы &quot;P&quot;, &quot;a&quot;, &quot;c&quot; два &quot;е&quot; написаны анлийскими символами
; Если просто читать то слова одинаковы, но в хексе разные
rush := StringToHex(rus)
engh := StringToHex(eng)
msgbox, rus: %rus%`nHEX rus: %rush%`neng: %eng%`nHEX eng: %engh% ; показывает в хексе символы

for s, r in {A:&quot;А&quot;, a:&quot;а&quot;, E:&quot;Е&quot;, e:&quot;е&quot;, T:&quot;Т&quot;, O:&quot;О&quot;, o:&quot;о&quot;, P:&quot;Р&quot;, p:&quot;р&quot;, H:&quot;Н&quot;, K:&quot;К&quot;, k:&quot;к&quot;, X:&quot;Х&quot;, x:&quot;х&quot;, C:&quot;С&quot;, c:&quot;с&quot;, B:&quot;В&quot;, M:&quot;М&quot;} ; слева символ на английском, справа после двоеточия на русском

StringReplace, eng, eng, % s, % r, All ; делает замену
engh := StringToHex(eng)
msgbox, rus: %rus%`nHEX rus: %rush%`neng: %eng%`nHEX eng: %engh%
; видно что заменятся и хекс одинаковый, кроме первой буквы. Первая буква становится маленькой

StringToHex(String)
	{
	local Old_A_FormatInteger, CharHex, HexString
	
	;Return &#039;0&#039; if the string was blank
	If !String
		Return 0
	
	;Save the current Integer format
	Old_A_FormatInteger := A_FormatInteger
	
	;Set the format of integers to their Hex value
	SetFormat, INTEGER, H
	
	;Parse the String
	Loop, Parse, String 
		{
		;Get the ASCII value of the Character (will be converted to the Hex value by the SetFormat Line above)
		CharHex := Asc(A_LoopField)
	
		;Comment out the following line to leave the &#039;0x&#039; intact
		StringTrimLeft, CharHex, CharHex, 2
		
		;Build the return string
		HexString .= CharHex . &quot; &quot;
		}
	;Set the integer format to what is was prior to the call
	SetFormat, INTEGER, %Old_A_FormatInteger%
	
	;Return the string to the caller
	Return HexString
	}
</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Dworkin)]]></author>
			<pubDate>Sun, 22 Jan 2017 06:29:13 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=111386#p111386</guid>
		</item>
	</channel>
</rss>
