CommandLine handler and UTF8 path

Bug #1412834 reported by hilaire on 2015-01-20
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Dr. Geo II
Medium
Unassigned

Bug Description

I have discovered a problem with my DrGeo command line handler. Its
purpose, under linux only for now, is to let the user open a DrGeo
sketch file from the desktop file manager by double-clicking on the file.

Sadly, it seems it does not work when non ascii characters are present
in the path or the filename.

The command line handler parameters are correctly set form the bash
script, I got this output:

drgeo --sketch=/home/hilaire/Axe-Symétrie/axes de symétrie.fgeo

But once in Pharo, the string representing the path to the file is
wrongly interpreted, I have this error from Pharo:

Error: /home/hilaire/Axe-Symétrie/axes de symétrie.fgeo does not exist!

From the DrGeo.sh startup script, Pharo is fired with this instruction:

exec "$VM/pharo" \
    --plugins "$VM" \
    --encoding utf-8 \
    -vm-display-X11 \
    -title "Dr.Geo" \
    $image \
    $DRGEO_OPT"$filename"

Opening this same file directly form DrGeo works correctly.

hilaire (hilaire-fernandes) wrote :

The path string received by Pharo should be converted to UTF8. I thought it was already in that format, but no because Pharo internal string are not UTF-8.

To fix the issue, modify following methods:

DrGeoCommandLineHandler>>loadScript: aString
 | workspace utfString |
 utfString := aString convertFromWithConverter: UTF8TextConverter new.
 self checkForFile: utfString.
 workspace := Workspace openFile: utfString.
 workspace containingWindow fullscreen.
 Compiler evaluate: workspace contents

and

DrGeoCommandLineHandler>>loadSketch: aString
 | utfString |
 utfString := aString convertFromWithConverter: UTF8TextConverter new.
 self checkForFile: utfString.
 DrGeo fileFullscreen: utfString

Changed in drgeo:
milestone: none → wip
importance: Undecided → Medium
status: New → Triaged
Changed in drgeo:
status: Triaged → Fix Committed
Changed in drgeo:
milestone: wip → 15.04
Changed in drgeo:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers