Re: Re: Re: Does gstreamer supports utf-8/unicode?

Jan Spurný JSpurny at seznam.cz
Mon Mar 5 07:11:31 PST 2012


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: Χρήστος Τριανταφύλλης <christriant1995 at gmail.com>
> 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ý <JSpurny at seznam.cz>
> 
> > 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: Χρήστος Τριανταφύλλης <christriant1995 at gmail.com>
> > > 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 <t.i.m at zen.co.uk>
> > >
> > > > 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
> > > > gstreamer-devel at lists.freedesktop.org
> > > > http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
> > > >
> > >
> > >
> > >
> > _______________________________________________
> > gstreamer-devel mailing list
> > gstreamer-devel at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
> >
> 
> 
> 


More information about the gstreamer-devel mailing list