<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: Конвертация текста]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=15343&amp;type=atom" />
	<updated>2020-05-05T21:00:24Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=15343</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Конвертация текста]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=139352#p139352" />
			<content type="html"><![CDATA[<p>Или так:<br /></p><div class="codebox"><pre><code>str =
(
&lt;a i=0&gt;por&lt;/a&gt; &lt;a i=1&gt;Thierry Meyssan
)
MsgBox, % EncodeDecodeURI(str)

EncodeDecodeURI(str, encode := true, component := true) {
   for k, v in [[&quot;\&quot;, &quot;\\&quot;], [&quot;&#039;&quot;, &quot;\&#039;&quot;], [&quot;`r&quot;, &quot;\r&quot;], [&quot;`n&quot;, &quot;\n&quot;]]
      str := StrReplace(str, v[1], v[2])
   Return GetJS().( (encode ? &quot;en&quot; : &quot;de&quot;) . &quot;codeURI&quot; . (component ? &quot;Component&quot; : &quot;&quot;) . &quot;(&#039;&quot; . str . &quot;&#039;)&quot; )
}

GetJS() {
   static doc := ComObjCreate(&quot;htmlfile&quot;)
        , _ := doc.write(&quot;&lt;meta http-equiv=&quot;&quot;X-UA-Compatible&quot;&quot; content=&quot;&quot;IE=9&quot;&quot;&gt;&quot;)
        , JS := ObjBindMethod(doc.parentWindow, &quot;eval&quot;)
   Return JS
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2020-05-05T21:00:24Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=139352#p139352</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Конвертация текста]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=139350#p139350" />
			<content type="html"><![CDATA[<p>Можно так ещё:<br /></p><div class="codebox"><pre><code>str =
(
&lt;a i=0&gt;por&lt;/a&gt; &lt;a i=1&gt;Thierry Meyssan
)
MsgBox % UriEncode(str)

URIEncode(str) {
   static flags := ( URL_ESCAPE_PERCENT      := 0x01000 )
                 | ( URL_ESCAPE_SEGMENT_ONLY := 0x02000 )
                 | ( URL_ESCAPE_AS_UTF8      := 0x40000 )
   size := StrLen(str)*2
   Loop 2
      VarSetCapacity(buff, (size + 1) &lt;&lt; !!A_IsUnicode)
   until DllCall(&quot;Shlwapi\UrlEscape&quot;, &quot;Str&quot;, str, &quot;Str&quot;, buff, &quot;UIntP&quot;, size, &quot;UInt&quot;, flags) = 0
   Return StrReplace(buff, &quot;+&quot;, &quot;%2B&quot;)
}</code></pre></div><p>Если каки-то символы не будет кодировать, можно ещё StrReplace добавить.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2020-05-05T20:56:24Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=139350#p139350</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Конвертация текста]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=139349#p139349" />
			<content type="html"><![CDATA[<p><strong>ypppu</strong><br />Действительно, это не команда).</p>]]></content>
			<author>
				<name><![CDATA[DD]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=25263</uri>
			</author>
			<updated>2020-05-05T20:34:04Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=139349#p139349</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Конвертация текста]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=139348#p139348" />
			<content type="html"><![CDATA[<p><strong>Malcev</strong><br />Спасибо. Знал, что у <strong>teadrinker</strong>`a в скрипте это использовалось, но забыл название). По какой причине скрипт кодирует не полностью — пропускает угловые скобки?<br /></p><div class="codebox"><pre><code>str =
(
&lt;a i=0&gt;por&lt;/a&gt; &lt;a i=1&gt;Thierry Meyssan
)
MsgBox % UriEncode(str)

;-------------------------------------------------
; HTML encode/decode
;------------------------------------------------

UriEncode(str)
{ ; v 0.3 / (w) 24.06.2008 by derRaphael / zLib-Style release
   b_Format := A_FormatInteger
   data := &quot;&quot;
   SetFormat,Integer,H
   Loop,Parse,str
      if ((Asc(A_LoopField)&gt;0x7f) || (Asc(A_LoopField)&lt;0x30) || (asc(A_LoopField)=0x3d))
         data .= &quot;%&quot; . ((StrLen(c:=SubStr(ASC(A_LoopField),3))&lt;2) ? &quot;0&quot; . c : c)
      Else
         data .= A_LoopField
   SetFormat,Integer,%b_format%
   return data
}

UriDecode(str)
{ ; v 0.1 / (w) 28.06.2008 by derRaphael / zLib-Style release
   Loop,Parse,str,`%
      txt := (A_Index=1) ? A_LoopField : txt chr(&quot;0x&quot; substr(A_LoopField,1,2)) SubStr(A_LoopField,3)
   return txt
}

UnSlashUnicode(s)
{
  ; unslash unicode sequences like \u0026
  ; by Mikhail Kuropyatnikov 2009 (micdelt@mail.ru)
   rx = \\u([0-9a-fA-F]{4})
   pos = 0

   loop
   {
   pos := RegExMatch(s,rx,m,pos+1)
   if (pos = 0)
      break
   StringReplace, s, s, %m%, % Chr(&quot;0x&quot; . SubStr(m,3,4))
   }
   
   return s
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[DD]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=25263</uri>
			</author>
			<updated>2020-05-05T20:32:46Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=139348#p139348</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Конвертация текста]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=139346#p139346" />
			<content type="html"><![CDATA[<p>Ищите UriEncode().</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2020-05-05T20:12:44Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=139346#p139346</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Конвертация текста]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=139345#p139345" />
			<content type="html"><![CDATA[<p>Вроде специальной команды нет. Можно <a href="https://www.design-sites.ru/utility/url-encoding.php">тут</a> сконвертировать.</p>]]></content>
			<author>
				<name><![CDATA[ypppu]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=5974</uri>
			</author>
			<updated>2020-05-05T20:04:17Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=139345#p139345</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: Конвертация текста]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=139342#p139342" />
			<content type="html"><![CDATA[<p>Какой командой можно конвертировать текст из первого во второй?</p><div class="codebox"><pre><code>&lt;a i=0&gt;por&lt;/a&gt; &lt;a i=1&gt;Thierry Meyssan</code></pre></div><div class="codebox"><pre><code>%3Ca%20i%3D0%3Epor%20%3C%2Fa%3E%3Ca%20i%3D1%3EThierry%20Meyssan</code></pre></div>]]></content>
			<author>
				<name><![CDATA[DD]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=25263</uri>
			</author>
			<updated>2020-05-05T19:10:53Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=139342#p139342</id>
		</entry>
</feed>
