<?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="http://forum.script-coding.com/extern.php?action=feed&amp;tid=5251&amp;type=atom" />
	<updated>2010-12-06T16:21:05Z</updated>
	<generator>PunBB</generator>
	<id>http://forum.script-coding.com/viewtopic.php?id=5251</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Корректная передача Юникода из переменной при создания файла]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=42597#p42597" />
			<content type="html"><![CDATA[<p>В какой конкретно кодировке текст? Если в Utf-8, поможет <a href="http://forum.script-coding.com/viewtopic.php?pid=34568#p34568">такая</a> функция:<br /></p><div class="codebox"><pre><code>Utf8ToAnsi(Utf8String, CodePage = 1251)
{
    If (NumGet(Utf8String) &amp; 0xFFFFFF) = 0xBFBBEF
        BOM = 3
    Else
        BOM = 0

    UniSize := DllCall(&quot;MultiByteToWideChar&quot;, &quot;UInt&quot;, 65001, &quot;UInt&quot;, 0
                                            , &quot;UInt&quot;, &amp;Utf8String + BOM, &quot;Int&quot;, -1
                                            , &quot;Int&quot;, 0, &quot;Int&quot;, 0)
    VarSetCapacity(UniBuf, UniSize * 2)
    DllCall(&quot;MultiByteToWideChar&quot;, &quot;UInt&quot;, 65001, &quot;UInt&quot;, 0
                                 , &quot;UInt&quot;, &amp;Utf8String + BOM, &quot;Int&quot;, -1
                                 , &quot;UInt&quot;, &amp;UniBuf, &quot;Int&quot;, UniSize)

    AnsiSize := DllCall(&quot;WideCharToMultiByte&quot;, &quot;UInt&quot;, CodePage, &quot;UInt&quot;, 0
                                             , &quot;UInt&quot;, &amp;UniBuf, &quot;Int&quot;, -1
                                             , &quot;Int&quot;, 0, &quot;Int&quot;, 0
                                             , &quot;Int&quot;, 0, &quot;Int&quot;, 0)
    VarSetCapacity(AnsiString, AnsiSize)
    DllCall(&quot;WideCharToMultiByte&quot;, &quot;UInt&quot;, CodePage, &quot;UInt&quot;, 0
                                 , &quot;UInt&quot;, &amp;UniBuf, &quot;Int&quot;, -1
                                 , &quot;Str&quot;, AnsiString, &quot;Int&quot;, AnsiSize
                                 , &quot;Int&quot;, 0, &quot;Int&quot;, 0)
    Return AnsiString
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2010-12-06T16:21:05Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=42597#p42597</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: Корректная передача Юникода из переменной при создания файла]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=42547#p42547" />
			<content type="html"><![CDATA[<p>Получается когда создаю файл из переменной с русским текстом, получаются каракули, когда помещаю в клипборд то нормально отображает. Как сделать чтоб корректно работало?(то есть создать файл без каракуль:))</p>]]></content>
			<author>
				<name><![CDATA[Alex112]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=25738</uri>
			</author>
			<updated>2010-12-06T07:51:37Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=42547#p42547</id>
		</entry>
</feed>
