Problem in discover_uri with tone at greek words

Tim-Philipp Müller t.i.m at zen.co.uk
Fri Mar 9 02:22:08 PST 2012


On Thu, 2012-03-08 at 20:31 +0200, Χρήστος Τριανταφύλλης wrote:

> i have this line 
> 
>   info = newitem.discover_uri(("file://" + path).encode('utf-8'))
> 
> and with the .encode() it works with everything i enter on path
> variable but when
> the path variable contains a letter with a tone in greek , for example
> "/home/chris/Μουσική"
> the tone is the ' above the letter "η" at the end of the string in our
> current example, i get this error 
> 
>   info = newitem.discover_uri(("file://" + path).encode('utf-8'))
>   glib.GError: Δεν βρέθηκε ο πόρος.
> 
> the "Δεν βρέθηκε ο πόρος." can be translated to "the source hasn't
> been found", something like that :P
> 
> do you have any idea how to solve this?

To repeat what I said last time:

On Linux/*nix a filename path is just a bunch of bytes. It may be in any
(8-bit) encoding, ISO-8859-X, UTF-8, whatever. You need to acquire the
filename/filepath in the file system encoding or convert it to the
encoding used. It's a bit of a mess, esp. with the python layer on top,
but I'm sure there are docs somewhere that explain it in more detail.
Then you need to create a URI from that file path. Prefixing it with
'file://' may sometimes work, but is not correct and won't work with
relative paths either.

GStreamer (on Linux) expects a URI that expresses the file path in file
system encoding. This isn't necessarily UTF-8, but might be. (We don't
know.)

 Cheers
  -Tim



More information about the gstreamer-devel mailing list