×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Dec 2008
    Posts
    35

    File path encodings

    Hi everyone,

    it seems like I stumbled into another problem. I want to query user for a filename, then open this file as an image. The trouble starts when the user inputs non-ascii characters in the path to file. I use the following code:

    Code:
    import os, appuifw, graphics
    
    t=appuifw.query(u'dir','text')
    
    print os.path.exists(t)
    
    sz=graphics.Image.open(t)
    In the test case, if the path contains cyrillic symbols, graphics.Image.open fails with KErrUnderflow error, even though os.path.exists works as intended. Any suggestions on how to avoid this error?

  2. #2
    Super Contributor
    Join Date
    Nov 2007
    Location
    Sertaozinho/Brazil
    Posts
    768

    Re: File path encodings

    Quote Originally Posted by uhm57 View Post
    In the test case, if the path contains cyrillic symbols, graphics.Image.open fails with KErrUnderflow error, even though os.path.exists works as intended. Any suggestions on how to avoid this error?
    Bug ? How about to use utf instead unicode for Image.open() ?

    Code:
    sz=graphics.Image.open(t.encode("utf-8"))
    Just a guess ... I did not tried it.
    Documentation does not talk about filename encoding and we do not have any related bug reported.

  3. #3
    Registered User
    Join Date
    Dec 2008
    Posts
    35

    Re: File path encodings

    Sorry, it's not a bug, it's just my mistake. Nothing wrong with the encodings, the file I used as a test subject was accidentally a png-file with zero length, so that was the source of error. I apologize for that false alarm

Similar Threads

  1. Regarding BMCONV
    By sanah007 in forum Symbian
    Replies: 2
    Last Post: 2009-05-26, 12:47
  2. [split] mbm build error
    By mando222 in forum Symbian Tools & SDKs
    Replies: 1
    Last Post: 2009-03-29, 12:32
  3. sound file path
    By symbians60 in forum Symbian Media (Closed)
    Replies: 1
    Last Post: 2007-09-10, 13:30
  4. Help needed with a 3gp file...
    By joedoe_1981 in forum Streaming and Video
    Replies: 0
    Last Post: 2007-07-18, 18:58
  5. File server: Compilation error in carbide.c++
    By justteam in forum Symbian
    Replies: 6
    Last Post: 2007-01-03, 23:44

Posting Permissions

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