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 write special character

I always got this error when i tried to write special characters directly into a label oder tableView: Error Domain=NSCocoaErrorDomain Code=261 UserInfo=0x616e160 "Operation could not be completed. (Cocoa error 261.)"

Now i solved this problem. I convert the char i need from the ASCII code width the javascript function: "String.fromCharCode(252)" and the error disappear. I hope this would help some of you guys ;)

— asked July 7th 2010 by lars schuettemeyer
  • character
  • ipad
  • iphone
  • umlaut
0 Comments

4 Answers

  • Hi,

    i got a similar issue, but i solved it with converting my files to UTF8.

    So i can write ä,ö,ü,ß etc. without your String function ;)

    — answered July 7th 2010 by Michael Gajda
    permalink
    0 Comments
  • Convert your file with aptana to utf8.

    • all files utf8: settings -> general -> workspace -> text file encoding
      screenshot

    • one file to utf8: right click on file -> properties -> text file encoding

    — answered February 14th 2011 by ben roe
    permalink
    1 Comment
    • Good Aptana tip, Ben! :)

      — commented February 14th 2011 by Paul Dowsett
  • How I convert the file to UTF8?

    Thanks!

    — answered January 19th 2011 by Osvaldo De Jesus
    permalink
    2 Comments
    • Try adding and using this function : http://phpjs.org/functions/utf8_encode:577

      — commented January 19th 2011 by Kosso
    • Thank you Kosso

      — commented January 19th 2011 by Osvaldo De Jesus
  • The function does help, because, if I'm trying to write in the UTF8-encoded file a character from Latin-1 Supplement UTF-8 table, it doesn't work in the application, whereas using String.fromCharCode works:

    var lblDay2 = Titanium.UI.createLabel({
        text:'Mar'+String.fromCharCode(355)+'i',
        ...
    });
    

    Not working:

    var lblDay2 = Titanium.UI.createLabel({
        text:'Mar?i',
        ...
    });
    

    I don't know why, maybe it's a bug :)

    — answered June 8th 2011 by Bogdan Irimia
    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.