Имя пользователя:
Пароль:  
Помощь | Регистрация | Забыли пароль?  

Показать сообщение отдельно

Старожил


Сообщения: 169
Благодарности: 4

Профиль | Отправить PM | Цитировать


Вот скрипт который должен удалить bom из файла, но он почему-то не работает
Код: Выделить весь код
<script language="VBScript">
' Removes the Byte Order Mark - BOM from a text file with UTF-8 encoding
' The BOM defines that the file was stored with an UTF-8 encoding.
Call RemoveBOM(filePath)
Public function RemoveBOM(filePath)
       
        ' Create a reader and a writer
                Dim writer,reader, fileSize
                Set writer = CreateObject('Adodb.Stream')
                Set reader = CreateObject('Adodb.Stream')
                'from the text file we just wrote
                reader.Open
                reader.LoadFromFile ('c:\test\1.txt')
       
        ' Copy all data from reader to writer, except the BOM
                writer.Mode=3
                writer.Type=1
                writer.Open
                reader.position=5
                reader.copyto writer,-1

        ' Overwrite file
                writer.SaveToFile ('c:\test\1.txt',8)
       
        ' Return file name
                RemoveBOM = ('c:\test\1.txt')
        ' Kill objects
                Set writer = Nothing
                Set reader = Nothing

end Function
</script>

Последний раз редактировалось dark-------13, 13-10-2013 в 11:13.


Отправлено: 10:15, 13-10-2013 | #7