Problem in discover_uri with tone at greek words

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem in discover_uri with tone at greek words

clepto
Hello,

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?

thanks in advance!

_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Problem in discover_uri with tone at greek words

Tim-Philipp Müller-2
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

_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Problem in discover_uri with tone at greek words

clepto
my system encoding is UTF-8

chris@chris-Aspire-5732Z:~$ python
Python 2.7.2+ (default, Feb 16 2012, 18:29:42)
[GCC 4.6.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.getfilesystemencoding()
'UTF-8'
>>>

how can i use discoverer if i dont use discover_uri with file:// ?
can i?

so is there any way to solve this?

2012/3/9 Tim-Philipp Müller <[hidden email]>
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

_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel