[IronPython] Writing to a file with unicode name
vernondcole at gmail.com
Fri Jul 9 18:51:50 CEST 2010
One problem you may be having is with Python trying to escape the
backslashes in your Windows file name. I tried a very simple test using the
Python "open" statement rather than any fancy .NET things. It created a file
with a japenese name on my Windows Vista laptop. Note that I used forward
(/) slashes where Windows users would expect a back (\) slash.
out = open(u"c:/temp/青山学院大学相模原キャンパス",'w')
The same code works in CPython, too. If I remove the "u" unicode indicator
then the same code will work in IronPython and Python 3.1, since it is
unnecessary in IPy and illegal in Python 3.
2010/7/9 abdalla ramadan <abdollaramadan.dev at gmail.com>
> I am trying to write to a file with the japanese name 青山学院大学相模原キャンパス
> The relative path I am passing to the methods is
> I used two methods
> s = StreamWriter(filenamenew, True, Encoding.UTF8)
> outputfile = codecs.open(filenamenew, "w",'utf_8_sig')
> which both throwed the following exception:
> Unhandled Exception: System.ArgumentException: Illegal characters in path.
> Thanks very much for advance.
> Users mailing list
> Users at lists.ironpython.com
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Ironpython-users