NTNU-Digilab / gcode-script

A python script converting Rhinocerous curve geometry to G-code instructions for laser-cutting
MIT License
2 stars 0 forks source link

Script fails to recognize layers with special characters (ÆØÅ++) #1

Open Weibye opened 7 years ago

Weibye commented 7 years ago

From @Weibye on August 22, 2017 16:28

Currently the script fails to recognize layers with special characters (ÆØÅ++). Need to implement either a solution or proper error handling.

Tried converting the Rhino.layerName string into different charsets without success, need more work on this.

Copied from original issue: Weibye/gcode-script#1

Weibye commented 7 years ago

The issue is rooted in IronPython.

Resources on issue: https://ironpython-test.readthedocs.io/en/latest/howto/unicode.html https://ironpython-test.readthedocs.io/en/latest/library/codecs.html#standard-encodings

Weibye commented 7 years ago

The issue is this particular issue: http://lists.wixtoolset.org/pipermail/users-ironpython.com/2007-November/020932.html

The first problem is that if the string contains characters 127 (0x7F) or 128 (0x80), str() will return a Unicode string rather than an 8-bit string. CPython, on the other hand, returns a standard 8-bit string for both of those cases. Then, if the string contains any bytes greater than 128, it throws an exception. CPython, on the other hand, is happy to have bytes up to 0xFF in an 8-bit string.

CodePlex issue page: http://ironpython.codeplex.com/workitem/14104 It was apparently fixed or updated then closed in IronPython 2.7.3. Currently running IronPython 2.7.5, but still no dice.

On further investigation it seems to have been closed due to migration over to GitHub, but not been reopened over there.

Have yet to find a solution for it.