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!<br>when i use with greek characters (i am from greece) the program gives me the above error!<br>but all the strings are at utf-8...i am not sure if the problem is in python or gstreamer...<br>
so i asked here for your help! :)<br><br><div class="gmail_quote">2012/3/5 Jan Spurný <span dir="ltr"><<a href="mailto:JSpurny@seznam.cz">JSpurny@seznam.cz</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
<br>
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: <a href="http://docs.python.org/howto/unicode.html" target="_blank">http://docs.python.org/howto/unicode.html</a>). Quick tips:<br>
<br>
1) use: unicode_path = path.decode('utf-8') # or other encoding you use<br>
2) use:<br>
# -*- coding: utf-8 -*-<br>
at the top of the source file (1st or 2nd line)<br>
<br>
sincerely,<br>
Jan Spurny<br>
<br>
> ------------ Původní zpráva ------------<br>
> Od: Χρήστος Τριανταφύλλης <<a href="mailto:christriant1995@gmail.com">christriant1995@gmail.com</a>><br>
> Předmět: Re: Does gstreamer supports utf-8/unicode?<br>
> Datum: 05.3.2012 14:15:19<br>
> ----------------------------------------<br>
<div class="HOEnZb"><div class="h5">> i am using discoverer to get the tags from a file that why i am using<br>
> newitem.discover_uri("file://" + path)<br>
><br>
> it is the same to use the one you recommended?<br>
><br>
> 2012/3/5 Tim-Philipp Müller <<a href="mailto:t.i.m@zen.co.uk">t.i.m@zen.co.uk</a>><br>
><br>
> > On Mon, 2012-03-05 at 14:56 +0200, Χρήστος Τριανταφύλλης wrote:<br>
> ><br>
> > > i am writing a music player and i want to know if gstreamer supports<br>
> > > utf-8 and unicode because i have a problem here:<br>
> > ><br>
> > > info = newitem.discover_uri("file://" + path)<br>
> > > UnicodeEncodeError: 'ascii' codec can't encode characters in position<br>
> > > 19-25: ordinal not in range(128)<br>
> > ><br>
> > > the program is written in Python<br>
> ><br>
> > That is not how you create a valid URI from a filename.<br>
> ><br>
> > Use gst.filename_to_uri(path) instead (on Linux/*nix systems the<br>
> > filename is just a bunch of bytes in whatever encoding the filesystem<br>
> > uses. On Windows, the filename must be in UTF-8 format).<br>
> ><br>
> > Cheers<br>
> > -Tim<br>
> ><br>
> ><br>
> > _______________________________________________<br>
> > gstreamer-devel mailing list<br>
> > <a href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.freedesktop.org</a><br>
> > <a href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><br>
> ><br>
><br>
><br>
><br>
_______________________________________________<br>
gstreamer-devel mailing list<br>
<a href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><br>
</div></div></blockquote></div><br>