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

Campbell Barton ideasman42 at gmail.com
Mon Dec 7 11:42:21 CET 2009


Thanks for the hint, committed rev 25166 but since I cant redo this
bug someone else will need  to test to see if this fixes it.

See the report for details
http://projects.blender.org/tracker/index.php?func=detail&aid=20021&group_id=9&atid=498

On Mon, Dec 7, 2009 at 10: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
>



-- 
- Campbell


More information about the Bf-committers mailing list