<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; VBS: Проблема с кодировкой]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=9864&amp;type=atom" />
	<updated>2014-08-04T18:37:13Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=9864</id>
		<entry>
			<title type="html"><![CDATA[Re: VBS: Проблема с кодировкой]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=85621#p85621" />
			<content type="html"><![CDATA[<p>Для воспроизведения.</p>]]></content>
			<author>
				<name><![CDATA[alexii]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=1844</uri>
			</author>
			<updated>2014-08-04T18:37:13Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=85621#p85621</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS: Проблема с кодировкой]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=85618#p85618" />
			<content type="html"><![CDATA[<p>Спасибо за подсказку. Скажите, а зачем Вы свой код привели в пример ?</p>]]></content>
			<author>
				<name><![CDATA[wildwolf007]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=30994</uri>
			</author>
			<updated>2014-08-04T17:48:52Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=85618#p85618</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS: Проблема с кодировкой]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=85591#p85591" />
			<content type="html"><![CDATA[<p>Надо наоборот — «…, &quot;windows-1251&quot;, &quot;cp866&quot;)», поскольку содержимое в «cp866» <em>уже</em> прочтено как «windows-1251»:<br /></p><div class="codebox"><pre><code>Option Explicit

Dim strSourceFile


strSourceFile = &quot;E:\Песочница\0387\1.txt&quot;

With WScript.CreateObject(&quot;Scripting.FileSystemObject&quot;)
    If .FileExists(strSourceFile) Then
        With .OpenTextFile(strSourceFile)
            WScript.Echo StrConvert(.ReadAll(), &quot;windows-1251&quot;, &quot;cp866&quot;)
            .Close
        End With
    Else
        WScript.Echo &quot;Source file [&quot; &amp; strSourceFile &amp; &quot;] not found.&quot;
        WScript.Quit 1
    End If
End With

WScript.Quit 0
&#039;=============================================================================

&#039;=============================================================================
&#039; HKEY_CLASSES_ROOT\MIME\Database\Charset
&#039; cp866, windows-1251, koi8-r, unicode, utf-8, _autodetect
&#039;=============================================================================
Function StrConvert(ByVal strText, ByVal strSourceCharset, ByVal strDestCharset)
    Const adTypeText      = 2
    Const adModeReadWrite = 3
    
    
    With WScript.CreateObject(&quot;ADODB.Stream&quot;)
        .Type      = adTypeText
        .Mode      = adModeReadWrite
        
        .Open
        
        .Charset   = strSourceCharset
        .WriteText strText
        
        .Position  = 0
        .Charset   = strDestCharset
        StrConvert = .ReadText
        
        .Close
    End With
End Function
&#039;=============================================================================
</code></pre></div><p>P.S. Выкладывать же лучше на RGhost, предварительно упаковав в архив.</p>]]></content>
			<author>
				<name><![CDATA[alexii]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=1844</uri>
			</author>
			<updated>2014-08-03T19:18:53Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=85591#p85591</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[VBS: Проблема с кодировкой]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=85582#p85582" />
			<content type="html"><![CDATA[<p>Перерыл форум вроде нашел решение для переделывания кодировки, но чето не получается:</p><div class="codebox"><pre><code>

Set objFso = CreateObject(&quot;Scripting.FileSystemObject&quot;)

Set File = objFso.GetFile(&quot;C:\Users\Константин_2\Desktop\1.txt&quot;)

    Set vStream = objFso.OpenTextFile(File, 1, False)   &#039; Открываем исходный текст файл для чтения
    FillPutSendMask = vStream.ReadAll() 
    vStream.Close                                              &#039; Закрываем файл


WScript.Echo StrConv(FillPutSendMask,&quot;cp866&quot;,&quot;Windows-1251&quot;)

Function StrConv(Text,SourceCharset,DestCharset)
    Set Stream = CreateObject(&quot;ADODB.Stream&quot;)
    Stream.Type = 2
    Stream.Mode = 3
    Stream.Open
    Stream.Charset = SourceCharset
    Stream.WriteText Text
    Stream.Position = 0
    Stream.Charset = DestCharset
    StrConv = Stream.ReadText
End Function
</code></pre></div><p>Скажите где допустил ошибку ? Файл с кодировкой прикрепил.<br />Вроде через Far все получается просматривать через кнопочку F8.<br /><a href="http://www.fayloobmennik.net/3998969">http://www.fayloobmennik.net/3998969</a></p>]]></content>
			<author>
				<name><![CDATA[wildwolf007]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=30994</uri>
			</author>
			<updated>2014-08-03T17:37:20Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=85582#p85582</id>
		</entry>
</feed>
