Re: Re: Does gstreamer supports utf-8/unicode?
JSpurny at seznam.cz
Mon Mar 5 06:41:22 PST 2012
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
# -*- coding: utf-8 -*-
at the top of the source file (1st or 2nd line)
> ------------ 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
More information about the gstreamer-devel