<?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=15343</link>
		<atom:link href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=15343&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «AHK: Конвертация текста».]]></description>
		<lastBuildDate>Tue, 05 May 2020 21:00:24 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: AHK: Конвертация текста]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=139352#p139352</link>
			<description><![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>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Tue, 05 May 2020 21:00:24 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=139352#p139352</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Конвертация текста]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=139350#p139350</link>
			<description><![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>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Tue, 05 May 2020 20:56:24 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=139350#p139350</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Конвертация текста]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=139349#p139349</link>
			<description><![CDATA[<p><strong>ypppu</strong><br />Действительно, это не команда).</p>]]></description>
			<author><![CDATA[null@example.com (DD)]]></author>
			<pubDate>Tue, 05 May 2020 20:34:04 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=139349#p139349</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Конвертация текста]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=139348#p139348</link>
			<description><![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>]]></description>
			<author><![CDATA[null@example.com (DD)]]></author>
			<pubDate>Tue, 05 May 2020 20:32:46 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=139348#p139348</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Конвертация текста]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=139346#p139346</link>
			<description><![CDATA[<p>Ищите UriEncode().</p>]]></description>
			<author><![CDATA[null@example.com (Malcev)]]></author>
			<pubDate>Tue, 05 May 2020 20:12:44 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=139346#p139346</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Конвертация текста]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=139345#p139345</link>
			<description><![CDATA[<p>Вроде специальной команды нет. Можно <a href="https://www.design-sites.ru/utility/url-encoding.php">тут</a> сконвертировать.</p>]]></description>
			<author><![CDATA[null@example.com (ypppu)]]></author>
			<pubDate>Tue, 05 May 2020 20:04:17 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=139345#p139345</guid>
		</item>
		<item>
			<title><![CDATA[AHK: Конвертация текста]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=139342#p139342</link>
			<description><![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>]]></description>
			<author><![CDATA[null@example.com (DD)]]></author>
			<pubDate>Tue, 05 May 2020 19:10:53 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=139342#p139342</guid>
		</item>
	</channel>
</rss>
