Home Forums General XMetaL Discussion Turn off: Automatic Validation befor Saving a Document Reply To: Turn off: Automatic Validation befor Saving a Document

Derek Read

Reply to: Turn off: Automatic Validation befor Saving a Document

XMAX does not have any methods that will let you easily detect the encoding, however, you could parse the Document.Xml as a string to look for the XML PI (declaration) at the start of the file and pull out the value for encoding=”encodingtype”.

Having said that, FSO supports the creation of two types of files: “Unicode” and “ASCII”. There are no other options. Documentation at MSDN does not go into any detail about what they actually mean by “Unicode”: http://msdn.microsoft.com/en-us/library/5t9b5c0c%28VS.85%29.aspx However, after examining the resulting file with a hex editor I see that this option creates files that are encoded in UTF-16.

Note: I would not recommend trusting Notepad on XP to properly identify the encoding of a file (many people do use it for this purpose). It may be correct most of the time but there are inherent bugs in the algorithm it uses: http://en.wikipedia.org/wiki/Bush_hid_the_facts

So, if UTF-8 is a specific requirement (ie: UTF-16 produced with FSO is not OK) you will need to find a control other than FSO. MSXML should, and perhaps ADODB.Stream would be another option. Both of these controls are fully documented somewhere on MSDN or Microsoft.com and should be available on most machines. Any computer that has IE6 (or later) installed should have version of MSXML and ADODB can also be considered fairly standard. The posting here ( specifically the one dated Thursday, January 01, 2009 8:21 AM) may help: http://www.eggheadcafe.com/software/aspnet/33785134/how-to-configure-msxml2.aspx

Down the road we are looking into implementing a feature that will allow more options to be set in XMAX that are currently only supported in XMetaL Author only by setting INI variables.