[Bf-committers] Usage of PyUnicode_FromString() in blender 2.50

joe joeedh at gmail.com
Tue Dec 8 16:43:21 CET 2009


BTW, keep in mind that on windows, argv is always in ascii (not UTF-8).

Joe

On Mon, Dec 7, 2009 at 1:44 AM, Yomgui <yomgui1 at gmail.com> wrote:
> Hi,
>
> I've seen in many places that the Python function PyUnicode_FromString
> (and similar) is used to convert system strings like argv[] and IO
> pathname.
>
> If we look at the Python 3.1 documentation
> (http://docs.python.org/3.1/c-api/unicode.html?highlight=pyunicode_fromstring#PyUnicode_FromString)
> this function supposes that the input string is UTF-8 encoded.
> That's not a strict rule for all OS. This function should be reserved
> to pass string for runtime usage like if it was given in a script, but
> not for OS/IO strings.
>
> A better (I know... with just more arguments) function to convert
> system strings is PyUnicode_Decode()
> and use as encoding parameter: Py_FileSystemDefaultEncoding
>
> Thanks.
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at blender.org
> http://lists.blender.org/mailman/listinfo/bf-committers
>


More information about the Bf-committers mailing list