Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Encode / Decode / Unicode ?

    PYTHON Development
    0
    1
    665
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      Helper
      last edited by

      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

      On 15/02/2011 at 07:05, xxxxxxxx wrote:

      Hi folks,

      I still try to finish my texturereplacementscript which works pretty nice on the R12 with a little exception.

      Here is the tricky part of what I have so far:

      if shd.GetType() == c4d.Xbitmap:
            print "old----------->", shd[c4d.BITMAPSHADER_FILENAME]
            file = os.path.basename(shd[c4d.BITMAPSHADER_FILENAME])
            print "File--------->", File
            shd[c4d.BITMAPSHADER_FILENAME] = path + os.sep + file
        print "New Path---->", shd[c4d.BITMAPSHADER_FILENAME]

      As said it works nicely, if the filenames are "normal" means that there are no mutated vowels (umlaut) or other non-ascii-conform characters in the filename.

      If so( filename: 9Tür.jpg e.g.)  the console shows me something like that:

      old-----------> C:\sg\Test\9Tür.jpg
      File ---> u00FCr.jpg
      New path ---> T:\python est\9Tür.jpg

      If I could only trust the print statement ...

      In C4D the replaced path is : T:\python est\u00FCr.jpg

      The problem is that the last "" (which determines the end of a directory path) is not the one it should be.
      The last "" is in front of the non-ascii character : "\u00FCr.jpg"
      That is the reason why I can't use split path for that.

      I also tried newpath.encode("UTF-8")

      but without any noticable effect.

      Can anyone give me a hint how to deal with that please?

      1 Reply Last reply Reply Quote 0
      • First post
        Last post