Hello, i am writing a music player and i want to know if gstreamer supports utf-8 and unicode because i have a problem here:
info = newitem.discover_uri("file://" + path) UnicodeEncodeError: 'ascii' codec can't encode characters in position 19-25: ordinal not in range(128) the program is written in Python _______________________________________________ gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
On Mon, 2012-03-05 at 14:56 +0200, Χρήστος Τριανταφύλλης wrote:
> i am writing a music player and i want to know if gstreamer supports > utf-8 and unicode because i have a problem here: > > info = newitem.discover_uri("file://" + path) > UnicodeEncodeError: 'ascii' codec can't encode characters in position > 19-25: ordinal not in range(128) > > the program is written in Python That is not how you create a valid URI from a filename. Use gst.filename_to_uri(path) instead (on Linux/*nix systems the filename is just a bunch of bytes in whatever encoding the filesystem uses. On Windows, the filename must be in UTF-8 format). Cheers -Tim _______________________________________________ gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
i am using discoverer to get the tags from a file that why i am using
newitem.discover_uri("file://" + path) it is the same to use the one you recommended? 2012/3/5 Tim-Philipp Müller <[hidden email]>
_______________________________________________ gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Hi,
maybe I'm wrong but it seems to me that this is more python than gstreamer problem - anyway, you should probably read something about encoding/unicode in python (for example: http://docs.python.org/howto/unicode.html). Quick tips: 1) use: unicode_path = path.decode('utf-8') # or other encoding you use 2) use: # -*- coding: utf-8 -*- at the top of the source file (1st or 2nd line) sincerely, Jan Spurny > ------------ Původní zpráva ------------ > Od: Χρήστος Τριανταφύλλης <[hidden email]> > Předmět: Re: Does gstreamer supports utf-8/unicode? > Datum: 05.3.2012 14:15:19 > ---------------------------------------- > i am using discoverer to get the tags from a file that why i am using > newitem.discover_uri("file://" + path) > > it is the same to use the one you recommended? > > 2012/3/5 Tim-Philipp Müller <[hidden email]> > > > On Mon, 2012-03-05 at 14:56 +0200, Χρήστος Τριανταφύλλης wrote: > > > > > i am writing a music player and i want to know if gstreamer supports > > > utf-8 and unicode because i have a problem here: > > > > > > info = newitem.discover_uri("file://" + path) > > > UnicodeEncodeError: 'ascii' codec can't encode characters in position > > > 19-25: ordinal not in range(128) > > > > > > the program is written in Python > > > > That is not how you create a valid URI from a filename. > > > > Use gst.filename_to_uri(path) instead (on Linux/*nix systems the > > filename is just a bunch of bytes in whatever encoding the filesystem > > uses. On Windows, the filename must be in UTF-8 format). > > > > 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 |
i have convert to utf-8 all the strings i pass to uri and when i use only string with english characters the program works!
when i use with greek characters (i am from greece) the program gives me the above error! but all the strings are at utf-8...i am not sure if the problem is in python or gstreamer... so i asked here for your help! :) 2012/3/5 Jan Spurný <[hidden email]> Hi, _______________________________________________ gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Hi,
I'm pretty sure the problem is in python - I had many similar problems with czech strings (as I am czech) - the main problem is that SOMEWHERE you read some string into python, but if the python does not know what is being read, it may assume it's 'ascii' unless you specify otherwise - so you have to explicitly tell him that what he reads is utf-8. As I said - I recomend reading that string encoding howto for python.. sincerely, Jan Spurny > ------------ Původní zpráva ------------ > Od: Χρήστος Τριανταφύλλης <[hidden email]> > Předmět: Re: Re: Does gstreamer supports utf-8/unicode? > Datum: 05.3.2012 15:51:28 > ---------------------------------------- > i have convert to utf-8 all the strings i pass to uri and when i use only > string with english characters the program works! > when i use with greek characters (i am from greece) the program gives me > the above error! > but all the strings are at utf-8...i am not sure if the problem is in > python or gstreamer... > so i asked here for your help! :) > > 2012/3/5 Jan Spurný <[hidden email]> > > > Hi, > > > > maybe I'm wrong but it seems to me that this is more python than gstreamer > > problem - anyway, you should probably read something about encoding/unicode > > in python (for example: http://docs.python.org/howto/unicode.html). Quick > > tips: > > > > 1) use: unicode_path = path.decode('utf-8') # or other encoding you use > > 2) use: > > # -*- coding: utf-8 -*- > > at the top of the source file (1st or 2nd line) > > > > sincerely, > > Jan Spurny > > > > > ------------ Původní zpráva ------------ > > > Od: Χρήστος Τριανταφύλλης <[hidden email]> > > > Předmět: Re: Does gstreamer supports utf-8/unicode? > > > Datum: 05.3.2012 14:15:19 > > > ---------------------------------------- > > > i am using discoverer to get the tags from a file that why i am using > > > newitem.discover_uri("file://" + path) > > > > > > it is the same to use the one you recommended? > > > > > > 2012/3/5 Tim-Philipp Müller <[hidden email]> > > > > > > > On Mon, 2012-03-05 at 14:56 +0200, Χρήστος Τριανταφύλλης wrote: > > > > > > > > > i am writing a music player and i want to know if gstreamer supports > > > > > utf-8 and unicode because i have a problem here: > > > > > > > > > > info = newitem.discover_uri("file://" + path) > > > > > UnicodeEncodeError: 'ascii' codec can't encode characters in position > > > > > 19-25: ordinal not in range(128) > > > > > > > > > > the program is written in Python > > > > > > > > That is not how you create a valid URI from a filename. > > > > > > > > Use gst.filename_to_uri(path) instead (on Linux/*nix systems the > > > > filename is just a bunch of bytes in whatever encoding the filesystem > > > > uses. On Windows, the filename must be in UTF-8 format). > > > > > > > > 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 > > > > > gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
ok thanks!
its ok to contact you at your email to tell you more about this problem so you can help me? 2012/3/5 Jan Spurný <[hidden email]> Hi, _______________________________________________ gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Hi,
sure, why not sincerely, Jan Spurny On Mon, 05 Mar 2012 18:12:12 +0100 (CET) Χρήστος Τριανταφύλλης <[hidden email]> wrote: > ok thanks! > > its ok to contact you at your email to tell you more about this problem so > you can help me? > > 2012/3/5 Jan Spurný <[hidden email]> > > > Hi, > > > > I'm pretty sure the problem is in python - I had many similar problems > > with czech strings (as I am czech) - the main problem is that SOMEWHERE you > > read some string into python, but if the python does not know what is being > > read, it may assume it's 'ascii' unless you specify otherwise - so you have > > to explicitly tell him that what he reads is utf-8. > > > > As I said - I recomend reading that string encoding howto for python.. > > > > sincerely, > > Jan Spurny > > > > > > > ------------ Původní zpráva ------------ > > > Od: Χρήστος Τριανταφύλλης <[hidden email]> > > > Předmět: Re: Re: Does gstreamer supports utf-8/unicode? > > > Datum: 05.3.2012 15:51:28 > > > ---------------------------------------- > > > i have convert to utf-8 all the strings i pass to uri and when i use only > > > string with english characters the program works! > > > when i use with greek characters (i am from greece) the program gives me > > > the above error! > > > but all the strings are at utf-8...i am not sure if the problem is in > > > python or gstreamer... > > > so i asked here for your help! :) > > > > > > 2012/3/5 Jan Spurný <[hidden email]> > > > > > > > Hi, > > > > > > > > maybe I'm wrong but it seems to me that this is more python than > > gstreamer > > > > problem - anyway, you should probably read something about > > encoding/unicode > > > > in python (for example: http://docs.python.org/howto/unicode.html). > > Quick > > > > tips: > > > > > > > > 1) use: unicode_path = path.decode('utf-8') # or other encoding you > > use > > > > 2) use: > > > > # -*- coding: utf-8 -*- > > > > at the top of the source file (1st or 2nd line) > > > > > > > > sincerely, > > > > Jan Spurny > > > > > > > > > ------------ Původní zpráva ------------ > > > > > Od: Χρήστος Τριανταφύλλης <[hidden email]> > > > > > Předmět: Re: Does gstreamer supports utf-8/unicode? > > > > > Datum: 05.3.2012 14:15:19 > > > > > ---------------------------------------- > > > > > i am using discoverer to get the tags from a file that why i am using > > > > > newitem.discover_uri("file://" + path) > > > > > > > > > > it is the same to use the one you recommended? > > > > > > > > > > 2012/3/5 Tim-Philipp Müller <[hidden email]> > > > > > > > > > > > On Mon, 2012-03-05 at 14:56 +0200, Χρήστος Τριανταφύλλης wrote: > > > > > > > > > > > > > i am writing a music player and i want to know if gstreamer > > supports > > > > > > > utf-8 and unicode because i have a problem here: > > > > > > > > > > > > > > info = newitem.discover_uri("file://" + path) > > > > > > > UnicodeEncodeError: 'ascii' codec can't encode characters in > > position > > > > > > > 19-25: ordinal not in range(128) > > > > > > > > > > > > > > the program is written in Python > > > > > > > > > > > > That is not how you create a valid URI from a filename. > > > > > > > > > > > > Use gst.filename_to_uri(path) instead (on Linux/*nix systems the > > > > > > filename is just a bunch of bytes in whatever encoding the > > filesystem > > > > > > uses. On Windows, the filename must be in UTF-8 format). > > > > > > > > > > > > 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 > > > > > > > > > > > > > > > _______________________________________________ > > 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 |
Free forum by Nabble | Edit this page |