I think that Hilaire is right, although I don't know enough to say how to handle the issue properly. I tried making a unix file called bär.pdf. I did this by pasting the name with umlout from Sabine's email. I don't understand the encodings (and my system is set up as US English), but I can say that this created a file in my Linux file system with a name that appears as expected, and includes the $a with umlout. If I paste the same string into my image (Squeak in my case, but I expect it should be similar in Pharo), then I find that I am working with a string in which the $a with umlaut is a single character with value 220. The OSProcess error that Sabine reports is apparently a result of this mismatch in encodings. I see an error message on my console window that also displays the file name differently (this is the stderr output from the OSProcess command, showing a file not found condition). I don't know if ZnCharacterEncoder handles the issue properly, but I would be happy to hear if it does :-) Apologies in advance if I am confused on character encoding, but I am trying to understand the issue that Sabine reported. Thanks, Dave On Sun, Jun 05, 2016 at 09:40:31PM +0200, Sven Van Caekenberghe wrote:
On 05 Jun 2016, at 21:07, Hilaire <hilaire@drgeo.eu> wrote:
Hello Sabine,
Just a suggestion. If your string is not pure ascii you may need to convert it to UTF8 first as this is what likely expect your OS host.
Indeed Pharo string are not internally encoded as utf8
If that is the case, that the OS expects a different encoding, then the OS(Sub)Process implementation should deal with it, not the user of the API.
Check the UTF8TextConverter class to do so.
No, these converters are conceptually wrong, since they encode String to String, while it should be String to ByteArray.
The ZnCharacterEncoder hierarchy should be used instead.
String>>#utf8Encoded is a convenience method that can be used to do a quick conversion.
Hilaire
Le 05/06/2016 18:39, Sabine Manaa a ??crit :
on command line, this works, my file is copied: cp /Library/WebServer/Documents/reports/b??r.pdf /Library/WebServer/Documents/reports/test.pdf
In Pharo (4+5) this does not work (file not copied, no error message) OSProcess command: 'cp /Library/WebServer/Documents/reports/b??r.pdf /Library/WebServer/Documents/reports/test-a.pdf'.
This works (file is copied): OSProcess command: 'cp /Library/WebServer/Documents/reports/bar.pdf /Library/WebServer/Documents/reports/test-b.pdf'.
Seems that german umlauts don't work.
Is there something, I can I do, I don't want to replace the umlauts in filenames...
Regards Sabine
-- Dr. Geo http://drgeo.eu