[Gambas-user] Problem with Conv() and XmlWrite

Benoit Minisini gambas at ...1...
Sun Dec 21 17:29:17 CET 2008


On dimanche 21 décembre 2008, Luigi Carlotto wrote:
> Come tu affermi, un problema di conversione può essere sicuramente
> causato da un carattere non convertibile; però, nelle ultime mail, avevo
> specificato che le stringhe usate nei miei test, avevano tutti caratteri
> in ASCII puro (<127).
> E' possibile che alcuni caratteri di controllo (es. Line Feed), possano
> causare qualche problema?
> Ho fatto alcune prove nella Console, ma non ho riscontrato problemi con
> questo tipo di caratteri.
>
> As you assert, a conversion problem can be sure caused from a not
> convertibile character; but, in the last mails, I had specified that the
> strings used in my tests, had all characters in pure ASCII (<127).
> It is possible that some characters of control (es. Line Feed), can
> cause some problem?
> I have made some tests in the Gambas2 Console, but I have not found
> problems with this type of characters.

If you are sure that your strings are ASCII, why doing 
Conv(TheString, "UTF-8", "ASCII")?

And the error message printed by the underlying iconv library is clear: your 
string is not ASCII.

According to you, The toString() methods always returns an accurate string.

According to the source code, Conv() receives a non-ascii string.

Can you check that, by splitting your code?

FOR EACH oItem IN oGroup.Items
  sType = oItem.toString()
  sType = Conv(sType, "UTF-8", "ASCII")
  oXml.Attribute(oItem.Name, sType)
NEXT

As for the crash with attributes values larger than 2000 characters, I will 
look later. But maybe you could send me a little project that shows the bug 
in that specific case? It will help a lot.

Regards,

-- 
Benoit Minisini




More information about the User mailing list