Ticket #1 (closed defect: fixed)

Opened 4 years ago

Last modified 4 years ago

Traceback in exporting a UFO from FontLab Studio 5, with non-ascii char in a glyph.note.

Reported by: erik Assigned to: somebody
Priority: minor Milestone:
Component: component1 Version:
Keywords: unicode ufo gliflib Cc:

Description

Exporting a UFO from FontLab? Studio 5 (other versions not tested) results in a traceback when a non-ascii char is in a glyph.note.

The glyph.note string appears to be unicode when it comes out of FL.

writeGlyphToString barfs when trying to write the note. The string is cast to unicode, then fed to the xmlwriter. A snippet from glyphLib.py:

		writer.begintag("note")
		writer.newline()
		for line in note.splitlines():
			writer.write(line.strip())
			writer.newline()
		writer.endtag("note")

But it looks like the writer doesn't want unicode.

Did something change in the way FL stores the notes? Did no one ever try to write an ΓΌ in a note?

Change History

02/01/08 14:13:01 changed by erik

Here's the traceback from FLS5:

Traceback (most recent call last):
  File "<string>", line 10, in ?
  File "/Users/erik/Develop/robofab/svn.robofab.com/trunk/robofab/Lib/robofab/objects/objectsFL.py", line 823, in writeUFO
    glyphSet.writeGlyph(glyph.name, glyph, glyph.drawPoints)
  File "/Users/erik/Develop/robofab/svn.robofab.com/trunk/robofab/Lib/robofab/glifLib.py", line 191, in writeGlyph
    data = writeGlyphToString(glyphName, glyphObject, drawPointsFunc)
  File "/Users/erik/Develop/robofab/svn.robofab.com/trunk/robofab/Lib/robofab/glifLib.py", line 368, in writeGlyphToString
    writer.write(line.strip())
  File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/FontTools/xmlWriter.py", line 37, in write
    self.writeraw(escape(data))
  File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/FontTools/xmlWriter.py", line 52, in writeraw
    self.file.write(data)
UnicodeEncodeError: 'ascii' codec can't encode character u'\x9f' in position 0: ordinal not in range(128)

02/02/08 06:40:38 changed by erik

  • status changed from new to closed.
  • resolution set to fixed.

02/02/08 06:41:03 changed by erik

Fixed in rev. 27.