UTF-8 encoding supports the add of a BOM mark at the firts 3 bytes of an UTF-8 file
These chars are \xEF\xBB\xBF and it is a "signature" that the document is formally UTF-8.
Although this BOM mark is optional in UTF-8, some documents may have it, so I think that it should be treated by Mr Benoir because if a document contais it, it will crash gb.form.editor. The crash message says it can't render the "image". I am not sure, but it seems that gambas tries to convert BOM mark in a utf-8 visible symbol.
So the solution is to SKIP these 3 bytes if they are present at the beginning of a document.
Code: Select all
'Suppose you got data from the file... in a variable called data:
If Left(data, 3) == "\xEF\xBB\xBF" Then
data = Mid( data, 4) ' Skips the BOM Mark, making the data safe for gambas
EndIf
'From here the data will be "clean"
Regards.
Sergio Abreu - Brazil