×

Discussion Board

Results 1 to 11 of 11
  1. #1
    Registered User
    Join Date
    Jan 2011
    Posts
    17

    Exclamation Unable to read Chinese resource file S40 SDK 2

    My app is translated into 9 national languages: English, French, Spanish, Portuguese, Italian, Chinese, Hindi, Russian, & Arabic.

    However, I've hit a really odd problem on S40 SDK 2. It cannot read the Chinese resource file - end of file is reached when attempting to read the first byte!

    All nine resource files can be read in S40 E3 & E6 and S60 emulators. The same behaviour is found on actual devices (I have used exactly the same build (JAD/JAR) on each emulator and device).

    The following resource file snippets are in English and Chinese respectively:

    1000=HTTP authorisation failed
    1010=Bad HTTP request
    1020=Customer information failed
    1030=Delivery limit exceeded
    1040=Error in connecting to drm server

    1000=HTTP授权失败
    1010=错误的HTTP请求
    1020=客户信息失败
    1030=交付超出限制
    1040=连接drm服务器时出错

    I have worked around the problem by loading the English resource file if no keys are loaded into the hash map, but I think this is a platform bug.
    Last edited by javadude; 2012-10-23 at 09:59. Reason: Corrected emulator edition

  2. #2
    Super Contributor
    Join Date
    Mar 2003
    Location
    Finland
    Posts
    9,556

    Re: Unable to read Chinese resource file S40 SDK 2

    What's the encoding format used in the Chinese file?

  3. #3
    Registered User
    Join Date
    Jan 2011
    Posts
    17

    Re: Unable to read Chinese resource file S40 SDK 2

    All resource files are in UTF-8.

    [Apologies for the slow response - I just found the alert email in my junk folder ]

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

    Re: Unable to read Chinese resource file S40 SDK 2

    How do you read those files? this.getClass().getResourceAsStream and then ByteArrayInputStream or InputStreamReader?

  5. #5
    Registered User
    Join Date
    Jan 2011
    Posts
    17

    Re: Unable to read Chinese resource file S40 SDK 2

    I create a reader from an input stream:

    InputStream stream = System.class.getResourceAsStream(path);
    Reader reader = new InputStreamReader(stream, encoding);

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

    Re: Unable to read Chinese resource file S40 SDK 2

    Try to break it down and debug it with ByteArrayInputStream and ‘new String(line, "UTF-8")’. Perhaps a single char is the problem.

  7. #7
    Registered User
    Join Date
    Jan 2011
    Posts
    17

    Re: Unable to read Chinese resource file S40 SDK 2

    I did originally debug this and found that I get an end of file attempting to read the first byte!

    Given that it only occurs on S40 SDK 2 I think this is a platform bug.

    I have logged a bug with Nokia for this - Bug 1073 - Unable to read Chinese resource file S40 SDK 2 but no-one is paying any attention.

    The trouble is that the platform returns end of file. I can't see a work-around for this so it's my app look ends up looking bad.

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

    Re: Unable to read Chinese resource file S40 SDK 2

    Even with ByteArrayInputStream? Which actual phones have you tested, I try to replicate it here then. Is there a (invalid) byte-order-mark (BOM) at the beginning of your file?

  9. #9
    Registered User
    Join Date
    Jan 2011
    Posts
    17

    Re: Unable to read Chinese resource file S40 SDK 2

    Each translation file is produced in exactly the same manner - i.e. from a spreadsheet: =CONCATENATE(<key_cell>,"=",<translation_cell>) where <translation_cell> is from a different column for each language - so I wouldn't expect any differences as far as keys are concerned, only values (translations).

    I currently test my app on Oracle SDK 3.2 (ok) and Nokia S40 E6 (ok) & S40 SDK 2 (fail) emulators. I then test on selected remote devices on Nokia.

    I used to test on Sun SDK 3.0, Nokia S40 E3 & S60 (all ok).

    The only one that has ever given me a problem is S40 SDK 2 (emulator and phones).

    I haven't yet tried your suggestion of ByteArrayInputStream and ‘new String(line, "UTF-8")’ so can't comment at this time.

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

    Re: Unable to read Chinese resource file S40 SDK 2

    I do not have a emulator at hand right now. Which phone model(s) have you tested?

  11. #11
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: Unable to read Chinese resource file S40 SDK 2

    Does this help?

Similar Threads

  1. Replies: 0
    Last Post: 2004-07-18, 17:12
  2. Resource file in Chinese
    By daoshan in forum Symbian
    Replies: 1
    Last Post: 2003-07-08, 10:02
  3. Compiling Chinese Resource File
    By daoshan in forum Symbian
    Replies: 5
    Last Post: 2003-07-08, 09:58
  4. Compile Chinese resource file
    By daoshan in forum Symbian
    Replies: 0
    Last Post: 2003-07-07, 16:24
  5. Read Chinese Text file and Display Chinese on Canvas Problem?
    By goeast in forum Mobile Java General
    Replies: 4
    Last Post: 2002-09-18, 03:28

Posting Permissions

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