×

Discussion Board

Results 1 to 13 of 13
  1. #1
    Registered User
    Join Date
    May 2009
    Location
    Rome
    Posts
    268

    Smile Char conversion problem in Nokia Asha sdk Localization Builder

    Let say i have a node like this in Localization data
    <locale country="HK" language="zh">
    <entry key="download" value="下載"/>
    <entry key="dataupdate" value="资料已更新"/>
    <entry key="datafailed" value="更新資料失敗或中止"/>

    after build i have this in messages_zh-HK.properties

    DOWNLOAD=??
    DATAUPDATE=?????
    DATAFAILED=?????????

    and of course the midlet shows question marks when running on device

    Any hints?
    Thanks in advance
    Keep it simple, stupid
    borg - http://store.ovi.com/content/116105

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,750

    Re: Char conversion problem in Nokia Asha sdk Localization Builder

    Without knowing anything about the story: does the input XML use UTF-8 encoding?

  3. #3
    Registered User
    Join Date
    May 2009
    Location
    Rome
    Posts
    268

    Re: Char conversion problem in Nokia Asha sdk Localization Builder

    Quote Originally Posted by wizard_hu_ View Post
    Without knowing anything about the story: does the input XML use UTF-8 encoding?
    yes i checked it as first, and set Text File encoding as UTF8 on xml source , despite that .properties output contains string like ????????? for not latin char
    Keep it simple, stupid
    borg - http://store.ovi.com/content/116105

  4. #4
    Nokia Developer Champion
    Join Date
    Mar 2013
    Posts
    686

    Re: Char conversion problem in Nokia Asha sdk Localization Builder

    When you read the file, do you also read the strings as UTF-8 encoded strings?
    if your using new String(byte[]) then switch to new String(byte[], "UTF-8")
    if your using DataInputStream make sure to use readUTF

  5. #5
    Registered User
    Join Date
    May 2009
    Location
    Rome
    Posts
    268

    Re: Char conversion problem in Nokia Asha sdk Localization Builder

    The problem does not happen at the time the code is executed
    It happens during the build process .. as i see Nokia SDK on eclipse uses 4 builders (see Project properties - Builders) that are Java Builder,Preverification Builder, Localization Builder, Package Builder
    The localization Builder transforms the source .xml in .properties and fails
    In fact xml contains correct strings , while output .properties do not
    That happen for not latin translation

    I'm using this technique and classes for Localization
    http://help.eclipse.org/helios/index...alization.html
    Last edited by lucarocchi; 2013-07-03 at 15:56.
    Keep it simple, stupid
    borg - http://store.ovi.com/content/116105

  6. #6
    Registered User
    Join Date
    Mar 2003
    Posts
    4,105

    Re: Char conversion problem in Nokia Asha sdk Localization Builder

    What is this localization builder? All I know is the Internationalization API (JSR-238) …

  7. #7
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,750

    Re: Char conversion problem in Nokia Asha sdk Localization Builder

    Yeah, those strings are probably gone as the 2 symbols 下載 converted to ?? is certainly not a display issue, as they should be at least 4 codes for anything UTF-8.
    Based on the documentation you have linked, the properties file(s) can be opened too. Can you check their encoding? Can you perhaps edit them yourself prior to packaging?
    I do not know how much access to the .properties file(s) you are granted, but according to this discussion, http://stackoverflow.com/questions/8...ing-in-eclipse, you may also experiment with using other ways to create them.

    An other thing is what Traud suggests, so at the end you may also consider testing if the Nokia-provided tools work better. See the Wiki link and the actual documentation (http://www.developer.nokia.com/Resou...alisation.html)

  8. #8
    Registered User
    Join Date
    May 2009
    Location
    Rome
    Posts
    268

    Re: Char conversion problem in Nokia Asha sdk Localization Builder

    you are right traud! that happens when someone uses tool supposed to be more productive
    Keep it simple, stupid
    borg - http://store.ovi.com/content/116105

  9. #9
    Registered User
    Join Date
    May 2009
    Location
    Rome
    Posts
    268

    Re: Char conversion problem in Nokia Asha sdk Localization Builder

    Quote Originally Posted by wizard_hu_ View Post
    Yeah, those strings are probably gone as the 2 symbols 下載 converted to ?? is certainly not a display issue, as they should be at least 4 codes for anything UTF-8.
    Based on the documentation you have linked, the properties file(s) can be opened too. Can you check their encoding? Can you perhaps edit them yourself prior to packaging?
    I do not know how much access to the .properties file(s) you are granted, but according to this discussion, http://stackoverflow.com/questions/8...ing-in-eclipse, you may also experiment with using other ways to create them.

    An other thing is what Traud suggests, so at the end you may also consider testing if the Nokia-provided tools work better. See the Wiki link and the actual documentation (http://www.developer.nokia.com/Resou...alisation.html)
    wizard_hu , in fact an encoding issue happens
    while the xml setting is UTF8 , the outputted properties file show encoding "Default (determined from content type:ISO-8859-1)"
    changing the setting to utf 8 to the .properties do not help as them are regenerates at each build as 8859

    so now i m trying to find where in eclipse it associate content type .properties to 8859-1 , no luck yet
    Or i will go with Internationalization API (JSR-238) as traud says
    Keep it simple, stupid
    borg - http://store.ovi.com/content/116105

  10. #10
    Registered User
    Join Date
    May 2009
    Location
    Rome
    Posts
    268

    Re: Char conversion problem in Nokia Asha sdk Localization Builder

    shai.i was right too ...
    i have disable the Localization Builder see Project node Preference - Builders
    Then i have typed some string in the properties
    Then i changed the autogenerated L10nResources.java
    by changing this line (210)
    reader = new InputStreamReader(stream);
    to
    reader = new InputStreamReader(stream,"UTF-8");

    Now it works
    Thank you all for useful suggestion
    Keep it simple, stupid
    borg - http://store.ovi.com/content/116105

  11. #11
    Nokia Developer Champion
    Join Date
    Mar 2013
    Posts
    686

    Re: Char conversion problem in Nokia Asha sdk Localization Builder

    Your most welcome glad i could help

    BTW if you still also have the problem with the files you see in your build env then here is what you need to do:
    right click on the file => properties => look for "text file encoding" and change it from the default to UTF-8

  12. #12
    Registered User
    Join Date
    May 2009
    Location
    Rome
    Posts
    268

    Re: Char conversion problem in Nokia Asha sdk Localization Builder

    Quote Originally Posted by shai.i View Post
    Your most welcome glad i could help

    BTW if you still also have the problem with the files you see in your build env then here is what you need to do:
    right click on the file => properties => look for "text file encoding" and change it from the default to UTF-8
    In this case changing text file encoding do not helps
    Every time the project rebuild the Localization builder delete and recreate the .properties and the encoding depend on general Properties for *.properties
    Even worst , the loc builder produces wrong .properties with every encoding
    I bet the internal java class do not work in utf-8
    The L10nResources.java generated by the wizard , use an InputStream without specifying explicity "UTF-8"
    i had to change the code for make it to works
    Keep it simple, stupid
    borg - http://store.ovi.com/content/116105

  13. #13
    Registered User
    Join Date
    Jan 2009
    Location
    Melbourne, Australia
    Posts
    2,571

    Re: Char conversion problem in Nokia Asha sdk Localization Builder

    This might make a good wiki article .... ? "Hint Hint"

Similar Threads

  1. Replies: 6
    Last Post: 2011-06-30, 12:41
  2. char conversion
    By yahoo2010 in forum Symbian
    Replies: 2
    Last Post: 2010-10-06, 22:41
  3. Conversion between char* and TBuf8<>
    By gloria799 in forum Symbian
    Replies: 2
    Last Post: 2007-11-17, 11:38
  4. Conversion between TPtrC and char*
    By haydn in forum Open C/C++
    Replies: 5
    Last Post: 2007-10-18, 04:17
  5. char* to TPtr conversion....
    By GeKI in forum Symbian
    Replies: 0
    Last Post: 2005-11-15, 19:34

Posting Permissions

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