Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

How to use french accentued characters from a database

When I extract data from a sqlite database, the accentued character are wrong (diamond with ?) like utf-8 problem in html

        var rows = db.execute('SELECT fr FROM taxons WHERE id=?',rowdata);
    var taxon_name = Ti.UI.createLabel({
        text: rows.field(0)
    });    
    win11.add(taxon_name);

Need something like utf8_encode() in PHP ! Any ideas ?

— asked March 30th 2010 by Bernard van den Eynde
  • database
0 Comments

4 Answers

  • Accepted Answer

    I used sqlite with unicode and had not problems so far.
    Are u storing the data in the right encoding?

    — answered March 30th 2010 by Peter Lum
    permalink
    0 Comments
  • try to escape the text:

    var rows = db.execute('SELECT fr FROM taxons WHERE id=?',rowdata);
        var taxon_name = Ti.UI.createLabel({
            text: escape(rows.field(0))  // this line
        }); 
        win11.add(taxon_name);
    
    — answered March 30th 2010 by Glenn Tillemans
    permalink
    0 Comments
  • escape does'nt work!
    I've got %uFFFD (diamond with ?) and %20 (space)

    — answered March 30th 2010 by Bernard van den Eynde
    permalink
    0 Comments
  • I thought it was unicode.
    But, Yes indeed, the error was there !

    — answered March 30th 2010 by Bernard van den Eynde
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.