Corrupted sketch file when Chinese content

Bug #1837745 reported by hilaire
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Dr. Geo
Fix Released
Undecided
Chao-Kuei Hung

Bug Description

I am running Dr. Geo 19.06 on Lubuntu 18.04. When naming a Dr. Geo object, I can input Chinese using the fcitx input method from the host. When I save the sketch, however, the *.fgeo xml file becomes garbage, as can be seen using an editor from the host OS. Then Dr. Geo will fail if asked to load the sketch. It's very easy to reproduce. Just create a point, give it a Chinese name, and save it.

Tags: core
Revision history for this message
hilaire (hilaire-fernandes) wrote :

Sketch with accentuated Latin characters has issue too....
Pharo 8 regression?

Revision history for this message
hilaire (hilaire-fernandes) wrote :

Indeed P8 regression. It works fine with DrGeo based on P7 (release 17.07)

Revision history for this message
hilaire (hilaire-fernandes) wrote :
Revision history for this message
hilaire (hilaire-fernandes) wrote :

P7 regression not P8

Chao-Kuei Hung (ckhung0)
description: updated
Revision history for this message
Chao-Kuei Hung (ckhung0) wrote :

Here is a correct fgeo file that contains a point with an English name.

(I cannot attach multiple files in a single comment, can I?)

Revision history for this message
Chao-Kuei Hung (ckhung0) wrote :

Here is a (damaged) fgeo file that contains a point with a zh_TW name "台灣".

Revision history for this message
hilaire (hilaire-fernandes) wrote :

The problem may come when saving and not loading.
But I can't input chinese (But pasting your Taiwan chinese word seem ok there). Better you can apply these changes below.

Apply this fix bellow to your running DrGeo instance:

Add and modify these three methods in the class DrGDirectoryLocal
(To open it, Shift-Enter, write its name, select it in the list and Enter)

putBinary: stream into: filename
 (location asFileReference / filename) ensureDelete binaryWriteStreamDo: [ :fileStream |
  fileStream nextPutAll: stream contents]

putText: stream into: filename
 (location asFileReference / filename) ensureDelete writeStreamDo: [ :fileStream |
  fileStream nextPutAll: stream contents]

put: stream into: filename
 stream isBinary
  ifTrue: [ self putBinary: stream into: filename]
  ifFalse: [ self putText: stream into: filename ]

Revision history for this message
hilaire (hilaire-fernandes) wrote :

If it is too much just drag and drop in DrGeo the attached st source of the modified class

Revision history for this message
Chao-Kuei Hung (ckhung0) wrote :

Yes, it works, thanks!

After opening the class editor, I click the put:into: method, replace the original code, and press ctrl-s to save. Then I click "+Inst. side meth" tab, paste another method, and press ctrl-s. Finally do the same for the 3rd method. After that, sketch saving works correctly. I can open the saved file in a text editor and see the Chinese name. Loading also works.

Changed in drgeo:
status: New → Fix Committed
Changed in drgeo:
milestone: 19.06 → 19.09
Changed in drgeo:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.