R12 str encoding issue



  • On 08/07/2013 at 22:45, xxxxxxxx wrote:

    Hi,

    I have the strange issue with non EN C4D version.

    Lets say, my C4D R12 is in the RU version and I have one multi-pass.

    The code:

    import c4d, os
    doc = c4d.documents.GetActiveDocument()
    rd = doc.GetActiveRenderData()
    mp = rd.GetFirstMultipass()
    name = mp.GetName()
    print type(name), name
    os.makedirs(os.path.join("/Users/Simukas/Desktop/TEST/", name))
    

    prints

    <type 'str'> Глубина
    

    but the folder will be created with very strange name

    \u0413\u043B\u0443\u0431\u0438\u043D\u0430
    

    Explaining image is here.

    This issue applies only to R12 and only if C4D interface language is not EN.

    Thanks for any comments in advance,
    Simonas



  • On 08/07/2013 at 23:42, xxxxxxxx wrote:

    \u0413\u043B\u0443\u0431\u0438\u043D\u0430 is the unicode hex repr of Глубина. it seems that 
    there is something going wrong with the unicode encoding in python. c4d should not have any 
    influence by your code example, as the error occurs for os.makedirs(). the only thing i could think
    of is that c4d language setting is somehow reflected in the environment variable of the c4d python 
    instance which again does influence python's unicode parsing. also building the path string manually
    might help (don't use os.path, use the raw string, enforce unicodedata encoding).



  • On 09/07/2013 at 00:04, xxxxxxxx wrote:

    ok... thanks, I'll check this latter :)


Log in to reply