<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: Конвертер юникодных символов в HTML-код]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=14281&amp;type=atom" />
	<updated>2018-11-02T01:20:15Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=14281</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Конвертер юникодных символов в HTML-код]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=129598#p129598" />
			<content type="html"><![CDATA[<p>Просто, наверное, в исходнике не для всех символов прописаны имена, а только числа.<br />Так как такой код тоже не трансформирует<br /></p><div class="codebox"><pre><code>oHTML := ComObjCreate(&quot;HTMLFile&quot;)
p := oHTML.createElement(&quot;p&quot;)
p.innerText := &quot;я&quot;
msgbox % p.innerHTML</code></pre></div><p>то можете создать свой парсер, который будет заменять уже все символы.<br /><a href="https://www.w3.org/TR/html5/syntax.html#named-character-references">https://www.w3.org/TR/html5/syntax.html … references</a></p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2018-11-02T01:20:15Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=129598#p129598</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Конвертер юникодных символов в HTML-код]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=129596#p129596" />
			<content type="html"><![CDATA[<p>Уже пробовал, экспериментировал с флагами, но Юникод не обрабатывается:<br /></p><div class="codebox"><pre><code>str = 
(
ωωωωω
Кириллица Kirillitsa 
&quot;&amp;&lt;&gt;
)
MsgBox, % ConvertToHtml(str)

ConvertToHtml(str)  {
   Loop, parse, str
   {
      ;if AnsiTestChar(A_LoopField)
      ;   htmlStr .= A_LoopField
      ;else  {
         Transform, out, HTML, % A_LoopField
         htmlStr .= out
      ;}
   }
   Return htmlStr
}

AnsiTestChar(char)  {
   VarSetCapacity(buff, 1, 0)
   StrPut(char, &amp;buff, &quot;cp0&quot;)
   Return StrGet(&amp;buff, &quot;cp0&quot;) == char
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[DD]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=25263</uri>
			</author>
			<updated>2018-11-01T23:32:14Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=129596#p129596</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Конвертер юникодных символов в HTML-код]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=129595#p129595" />
			<content type="html"><![CDATA[<p>Читайте внимательно команду transform.</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2018-11-01T23:20:06Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=129595#p129595</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Конвертер юникодных символов в HTML-код]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=129594#p129594" />
			<content type="html"><![CDATA[<p>Имелось в виду, что скрипт выше конвертирует символьный код вида <strong>&amp;xxxх;</strong> — на символы в буквальном виде, кириллицу и т.п. А хотелось бы обратного результата, чтобы кириллица и т.п., из буквального вида — конвертировалась в символьный код в формате <strong>&amp;xxxх;</strong>, как в переменной скрипта. <br />Нужно это для формирования пунктов дерева TOC формата HTML Help (CHM), в котором любые символы в Юникоде или в любом другом HTML-формате, отображаются как знаки вопросов.</p>]]></content>
			<author>
				<name><![CDATA[DD]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=25263</uri>
			</author>
			<updated>2018-11-01T23:16:01Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=129594#p129594</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Конвертер юникодных символов в HTML-код]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=129593#p129593" />
			<content type="html"><![CDATA[<p>Лично мне вопрос непонятен.</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2018-11-01T21:49:32Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=129593#p129593</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Конвертер юникодных символов в HTML-код]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=129591#p129591" />
			<content type="html"><![CDATA[<p>Как произвести обратную конвертацию из буквальных символов — в код в формате из скрипта? <br /></p><div class="codebox"><pre><code>HTM = 
(
&amp;agrave; 
&amp;aacute; 
&amp;acirc; 
&amp;atilde; 
&amp;auml; 
&amp;aring; 
&amp;iuml;&amp;icirc;&amp;auml;&amp;aring;&amp;euml;&amp;egrave;&amp;euml;&amp;ntilde;&amp;yuml; &amp;iuml;&amp;oacute;&amp;aacute;&amp;euml;&amp;egrave;&amp;ecirc;&amp;agrave;&amp;ouml;&amp;egrave;&amp;aring;&amp;eacute;
)

MsgBox, % ComUnHTML( HTM )

ComUnHTML(html) {
	oHTML := ComObjCreate(&quot;HtmlFile&quot;)
	oHTML.write(html)
	return oHTML.documentElement.innerText
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[DD]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=25263</uri>
			</author>
			<updated>2018-11-01T21:09:01Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=129591#p129591</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Конвертер юникодных символов в HTML-код]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=129565#p129565" />
			<content type="html"><![CDATA[<p><em></em></p>]]></content>
			<author>
				<name><![CDATA[DD]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=25263</uri>
			</author>
			<updated>2018-10-30T12:47:19Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=129565#p129565</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Конвертер юникодных символов в HTML-код]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=129559#p129559" />
			<content type="html"><![CDATA[<p><em></em></p>]]></content>
			<author>
				<name><![CDATA[DD]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=25263</uri>
			</author>
			<updated>2018-10-29T22:30:51Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=129559#p129559</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Конвертер юникодных символов в HTML-код]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=129556#p129556" />
			<content type="html"><![CDATA[<p>Спасибо в юникоде!</p>]]></content>
			<author>
				<name><![CDATA[DD]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=25263</uri>
			</author>
			<updated>2018-10-29T19:09:52Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=129556#p129556</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Конвертер юникодных символов в HTML-код]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=129555#p129555" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>str := &quot;Кириллица ω&quot;
MsgBox, % ConvertToHtml(str)

ConvertToHtml(str)  {
   Loop, parse, str
   {
      if AnsiTestChar(A_LoopField)
         htmlStr .= A_LoopField
      else  {
         Transform, out, HTML, % A_LoopField, 2
         htmlStr .= out
      }
   }
   Return htmlStr
}

AnsiTestChar(char)  {
   VarSetCapacity(buff, 1, 0)
   StrPut(char, &amp;buff, &quot;cp0&quot;)
   Return StrGet(&amp;buff, &quot;cp0&quot;) == char
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2018-10-29T18:45:39Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=129555#p129555</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Конвертер юникодных символов в HTML-код]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=129554#p129554" />
			<content type="html"><![CDATA[<p>Что тут не так сделано? —<br /></p><div class="codebox"><pre><code>str =
(
#   ё`.....;
)

n = 1 ; задать порядковый номер читаемого символа буфера обмена
StringLen, i, str ; определить длину строки в буфере обмена -&gt; %i%
Loop, %i% ; повторять процесс согласно количества символов в строке буфера обмена
{ 
   StringMid, char, str, %n%, 1 ; прочитать один символ из строки буфера обмена, начиная с первого -&gt; %char%

   AnsiTestChar(char)
   if not (char == 1)
      Transform, UNICODE, HTML, %char%, 2 ; перекодировать полученный символ в код HTML

   Done = %Done%%UNICODE% ; добавить полученное в конец строки переменной -&gt; %Done%
   n += 1 ; увеличить число на единицу, для чтения следующего символа буфера обмена
}
msgbox %Done%
n = 1 ; вернуть номер читаемого символа на единицу
Return

AnsiTestChar(char)  {
   VarSetCapacity(buff, 1, 0)
   StrPut(char, &amp;buff, &quot;cp0&quot;)
   Return StrGet(&amp;buff, 1, &quot;cp0&quot;) == char
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[DD]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=25263</uri>
			</author>
			<updated>2018-10-29T18:31:29Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=129554#p129554</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Конвертер юникодных символов в HTML-код]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=129552#p129552" />
			<content type="html"><![CDATA[<p>Вот так можно:<br /></p><div class="codebox"><pre><code>MsgBox, % AnsiTestChar(&quot;ω&quot;) . &quot;`n&quot; . AnsiTestChar(&quot;ё&quot;)

AnsiTestChar(char)  {
   VarSetCapacity(buff, 1, 0)
   StrPut(char, &amp;buff, &quot;cp0&quot;)
   Return StrGet(&amp;buff, 1, &quot;cp0&quot;) == char
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2018-10-29T17:21:32Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=129552#p129552</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Конвертер юникодных символов в HTML-код]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=129550#p129550" />
			<content type="html"><![CDATA[<p>Почему пробел не добавляет к переменной Done? Как сделать, чтобы не затрагивался не-юникод, ведь все равно нельзя будет перечислить все символы, которые не следует обрабатывать?</p>]]></content>
			<author>
				<name><![CDATA[DD]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=25263</uri>
			</author>
			<updated>2018-10-29T16:52:16Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=129550#p129550</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Конвертер юникодных символов в HTML-код]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=129549#p129549" />
			<content type="html"><![CDATA[<p>А что именно непонятно, там же все расписано.<br />Скрипт перебирает посимвольно буфер обмена, перекодирует каждый символ и добавляет его к переменной Done.<br />Это все можно заменить Loop, Parse.</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2018-10-29T16:07:52Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=129549#p129549</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Конвертер юникодных символов в HTML-код]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=129546#p129546" />
			<content type="html"><![CDATA[<p>Дык если б понял — и вопрос не стоял, потому и требуется намёк)).</p>]]></content>
			<author>
				<name><![CDATA[DD]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=25263</uri>
			</author>
			<updated>2018-10-29T15:33:27Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=129546#p129546</id>
		</entry>
</feed>
