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

Luigi Carlotto md9327 at ...120...
Mon Dec 22 21:27:17 CET 2008


Il giorno lun, 22/12/2008 alle 20.38 +0100, Luigi Carlotto ha scritto:

> > If you are sure that your strings are ASCII, why doing
> > Conv(TheString, "UTF-8", "ASCII")?
> Yes!
> 
> > And the error message printed by the underlying iconv library is
> clear: your
> > string is not ASCII.
> No (see result)!
> 
> > According to you, The toString() methods always returns an accurate
> string.
> Yes!
> 
> > According to the source code, Conv() receives a non-ascii string.
> No!
> 
> > 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
> 
> Result:
> 
> ...
> 150    FOR EACH oItem IN oGroup.Items
> 151      sType = oItem.toString()
> 152      PRINT sType
> 153      sType = Conv(sType, "UTF-8", "ASCII")
> 154      oXml.Attribute(oItem.Name, sType)
> 155    NEXT 
> ...
> 
> sType="ACTION,ADD,ALL,ALTER,ANALYZE,AND,AS,ASC,ASENSITIVE,BEFORE,BETWEEN,BIGINT,BINARY,BIT,BLOB,BOTH,BY,CALL,CASCADE,CASE,CHANGE,CHAR,CHARACTER,CHECK,COLLATE,COLUMN,CONDITION,CONNECTION,CONSTRAINT,CONTINUE,CONVERT,CREATE,CROSS,CURRENT_DATE,CURRENT_TIME,CURRENT_TIMESTAMP,CURRENT_USER,CURSOR,CURSOR DATABASE,DATABASES,DATE,DAY_HOUR,DAY_MICROSECOND,DAY_MINUTE,DAY_SECOND,DEC,DECIMAL,DECLARE,DEFAULT,DELAYED,DELETE,DESC,DESCRIBE,DETERMINISTIC,DISTINCT,DISTINCTROW,DIV,DOUBLE,DROP,DUAL,EACH,ELSE,ELSEIF,ENCLOSED,ENUM,ESCAPED,EXISTS,EXIT,EXPLAIN,FALSE,FETCH,FLOAT,FLOAT4,FLOAT8,FOR,FORCE,FOREIGN,FROM,FULLTEXT,GOTO,GRANT,GROUP,HAVING,HIGH_PRIORITY,HOUR_MICROSECOND,HOUR_MINUTE,HOUR_SECOND,IF,IGNORE,IN,INDEX,INFILE,INNER,INOUT,INSENSITIVE,INSERT,INT,INT1,INT2,INT3,INT4,INT8,INTEGER,INTERVAL,INTO,IS,ITERATE,JOIN,KEY,KEYS,KILL,LABEL,LEADING,LEAVE,LEFT,LIKE,LIMIT,LINES,LOAD,LOCALTIME,LOCALTIMESTAMP,LOCK,LONG,LONGBLOB,LONGTEXT,LOOP,LOW_PRIORITY,MATCH,MEDIUMBLOB,MEDIUMINT,MEDIUMTEXT,MIDDLEINT,MINUTE_MICROSECOND,MINUTE_SECOND,MOD,MODIFIES,NATURALNOT,NO,NO_WRITE_TO_BINLOG,NULL NUMERIC,ON,OPTIMIZE,OPTION,OPTIONALLY,OR,ORDER,OUT,OUTER,OUTFILE,PRECISION,PRIMARY,PROCEDURE,PURGE,READ,READS,REAL,REFERENCES,REGEXP,RELEASE,RENAME,REPEAT,REPLACE,REQUIRE,RESTRICT,RETURN,REVOKE,RIGHT,RLIKE,SCHEMA,SCHEMAS,SECOND_MICROSECOND,SELECT,SENSITIVE,SEPARATOR,SET,SHOW,SMALLINT,SONAME,SPATIAL,SPECIFIC,SQL,SQLEXCEPTION,SQLSTATE,SQLWARNING,SQL_BIG_RESULT,SQL_CALC_FOUND_ROWS,SQL_SMALL_RESULT,SSL STARTING,STRAIGHT_JOIN,TABLE TERMINATED,TEXT,THEN,TIME,TIMESTAMP,TINYBLOB,TINYINT,TINYTEXT,TO,TRAILING,TRIGGER,TRUE,UNDO,UNION,UNIQUE,UNLOCK,UNSIGNED,UPDATE,UPGRADE,USAGE,USE,USING,UTC_DATE,UTC_TIME,UTC_TIMESTAMP,VALUES,VARBINARY,VARCHAR,VARCHARACTER,VARYING,WHEN,WHERE,WHILE,WITH,WRITE,XOR,YEAR_MONTH,ZEROFILL"
> Error: Error writing XML data
> Code: -1
> Class: pgConfig
> Where: pgConfig.Save.154
> 
> As you can see, the error not verification in the conversion, but in
> the writing on XML, and the string “sType” (too long...) contains
> alone characters ASCII.
> 
> > 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.
> Ok! (see result).
> 
> Thanks


I have forgotten to add the rest of the error message, but it is
identical to the first one post.

encoding error: output conversion failed two to conv error, bytes 0xE5
0x31 0x32 0xE5 I/O error: encoder error
Error: Given Error writing XML
Tails: -1

The string does not contain characters of control (es. LineFeed).




More information about the User mailing list