×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Feb 2007
    Posts
    43

    Question How to change common string to unicode string?

    How to change common string to unicode string?

    I have a string in code like following:

    obj = someAPI()
    s = str(obj)

    Now I want to show the string s to user by appuifw.note(), but this function need a unicode string as parameter.

    So anyone can tell me hhow to change my s to unicode string to match this function?

  2. #2
    Registered User
    Join Date
    Feb 2005
    Location
    Belgium (Europe)
    Posts
    1,352

    Re: How to change common string to unicode string?

    Quote Originally Posted by jfml
    How to change common string to unicode string?

    I have a string in code like following:

    obj = someAPI()
    s = str(obj)

    Now I want to show the string s to user by appuifw.note(), but this function need a unicode string as parameter.

    So anyone can tell me hhow to change my s to unicode string to match this function?
    It's very easy
    There are two possibilities :
    Code:
    # first
    appuifw.note(unicode(s))
    
    # second
    appuifw.note(u'%s'%s)
    Cyke64
    pys60 1.4.5 and 2.0.0, pygame, PyS60 CE on E90 and 5800 !

    Find my pys60 extension modules on cyke64.googlepages.com

  3. #3
    Registered User
    Join Date
    Feb 2007
    Posts
    43

    Re: How to change common string to unicode string?

    Quote Originally Posted by cyke64
    It's very easy
    There are two possibilities :
    Code:
    # first
    appuifw.note(unicode(s))
    
    # second
    appuifw.note(u'%s'%s)
    Cyke64

    Thank you very much!!!

  4. #4
    Registered User
    Join Date
    Jan 2007
    Location
    Spain
    Posts
    21

    Re: How to change common string to unicode string?

    It's very easy
    There are two possibilities :
    Or three


    Code:
    # third
    appuifw.note(s.decode())

  5. #5
    Registered User
    Join Date
    Feb 2007
    Posts
    43

    Smile Re: How to change common string to unicode string?

    Quote Originally Posted by Skarabeus
    Or three


    Code:
    # third
    appuifw.note(s.decode())
    Thanks, too. Now I got 3 ways to resolve this issue.

Similar Threads

  1. Replies: 3
    Last Post: 2008-05-07, 16:08
  2. Change String to int and back
    By tertiusbouwer in forum Mobile Java General
    Replies: 1
    Last Post: 2006-06-07, 02:40
  3. change color of String Item
    By kumudranjan_19 in forum Mobile Java General
    Replies: 2
    Last Post: 2005-08-24, 19:19
  4. Using localized String constants (no Unicode)
    By doctordwarf in forum Mobile Java General
    Replies: 3
    Last Post: 2003-07-28, 19:04
  5. D211 new linux driver 1.04 not working !!
    By franz_meyer in forum Multimodecards
    Replies: 1
    Last Post: 2002-12-12, 08:31

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×