philw Posted September 16, 2009 Share Posted September 16, 2009 Is there any way to save files as utf-8, but without the byte order mark? The program I'm working on creates html files, and the w3c validator warns that including the byte order mark can cause problems when these are viewed in certain browsers. Thanks! Link to comment Share on other sites More sharing options...
jvanegmond Posted September 16, 2009 Share Posted September 16, 2009 Leave the byte order mark, the validator is being an idiot.The validator has a tendency to do stupid things.. github.com/jvanegmond Link to comment Share on other sites More sharing options...
philw Posted September 16, 2009 Author Share Posted September 16, 2009 I agree that the validation tool is far from perfect! It's just that, if the byte order mark is not actually necessary in Utf-8, should it be there? Does it do anything? Ok, browsers (and other applications) that get confused by the BOM are probably dinosaurs, but surely there's no point in including something that might cause issues, however unlikely this may be. Link to comment Share on other sites More sharing options...
jvanegmond Posted September 16, 2009 Share Posted September 16, 2009 Specifically not including BOM is like adding support for Mosaic, Netscape and IE4 browsers. You can read more about the subject here and here: http://en.wikipedia.org/wiki/UTF-8#Byte-order_mark http://en.wikipedia.org/wiki/Byte-order_mark To answer your original question, though, AutoIt FileOpen and FileWrite never write a BOM unless you specifically tell it to. If you have a string that already contains a byte order mark you can remove it like so: $s = StringToBinary("This is my string with a BOM.") ConsoleWrite("String length with BOM: " & BinaryLen($s) & @CRLF) $s = BinaryMid($s, 3, BinaryLen($s)-3) ConsoleWrite("String length without BOM: " & BinaryLen($s) & @CRLF) github.com/jvanegmond Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now