Hi there,
I'm currently having issues converting unicode characters on Windows...
I'm utilizing the AcceptDragObject
in a c4d.gui.TreeViewFunctions
.
I want to act on a given folder that is dragged into my treeview.
if dragtype == c4d.DRAGTYPE_FILENAME_OTHER
gives me the direct filepath.
For example I'm having a folder called test_with_äüö
on my Desktop.
My main issue is, that I need to work with the variable coming in from the dragtype
called dragobject
and can't convert the direct result!
Here's a simple test-script to play around with:
import c4d
import os
def _direct_conversion():
return r"C:\Users\lasse\Desktop\test_with_äüö".decode('utf-8')
def _from_variable():
dragobject = "C:\Users\lasse\Desktop\test_with_äüö"
s = r"%s" % (dragobject)
s = s.decode('utf-8')
return s
def main():
s = _direct_conversion()
s = _from_variable()
print "os.path.isdir:", os.path.isdir(s)
if __name__=='__main__':
main()
The bad thing is that the _direct_conversion()
gives me the correct result while _from_variable()
does not.
I'm probably totally overthinking this, but any ideas how to solve that "simple" problem are welcome!!! :)
Cheers,
Lasse