utf8 (chinese) in current working directory path on windows

Q&A's, tips, howto's
Locked
bairui
Posts: 64
Joined: Sun May 06, 2012 2:04 am
Location: China
Contact:

utf8 (chinese) in current working directory path on windows

Post by bairui »

I dev on a linux box and only get to test on a windows box periodically. I have noticed failures on the windows machine that are solved by simply ensuring that the newlisp script is moved to a directory that doesn't contain chinese characters in the path (like, C:\foo\). I saw an error at one stage along the lines of "read-file expected a string" if that helps in setting up a test.

winger
Posts: 46
Joined: Wed Mar 14, 2012 7:31 am

Re: utf8 (chinese) in current working directory path on wind

Post by winger »

can you show codes?
read-file can read content from pathname of utf8 (chinese) character.
Welcome to a newlisper home:)
http://www.cngrayhat.org

bairui
Posts: 64
Joined: Sun May 06, 2012 2:04 am
Location: China
Contact:

Re: utf8 (chinese) in current working directory path on wind

Post by bairui »

Thanks for the prompt, winger. I didn't show any code before because fails were happening in places that weren't failing in linux. I assumed there must have been a known windows glitch that people would inform me of here.

I finally got some time today to grab a windows box and look at the problem in detail. I was wrong in my original problem description: It's not a newLISP problem. It's a newLISP IDE problem. The newLISP code runs fine from the cmd terminal. But in the IDE I get an error like:

ERR: read-file expected string

Also in the IDE, when I try to save modifications to my file, I get a message box complaining that it can't save to the current file path. Instead of printing the actual chinese characters in the path, it just prints squares. I assume the IDE is without utf-8 charms and graces.

xytroxon
Posts: 296
Joined: Tue Nov 06, 2007 3:59 pm
Contact:

Re: utf8 (chinese) in current working directory path on wind

Post by xytroxon »

Just a thought...

Are you using the Windows UTF-8 version of newLISP?

The newLISP Windows installer is non-UTF-8

From: http://www.newlisp.org/downloads/UTF-8_win32/

Copy and paste newlisp.exe and newlisp.dll

To: C:\Program Files (x86)\newlisp

For extra credit ;o)

Do both versions cause the problem?

-- xytroxon
"Many computers can print only capital letters, so we shall not use lowercase letters."
-- Let's Talk Lisp (c) 1976

bairui
Posts: 64
Joined: Sun May 06, 2012 2:04 am
Location: China
Contact:

Re: utf8 (chinese) in current working directory path on wind

Post by bairui »

Thanks, xytroxon,

I was using the UTF-8 version, yes. I haven't tested this with the non-UTF-8 version.

I wonder... the GUI IDE depends on JRE... Might my Sun Java 1.7 JRE not be UTF-8 compatible? Is that even possible?

o_O

-- bazz

xytroxon
Posts: 296
Joined: Tue Nov 06, 2007 3:59 pm
Contact:

Re: utf8 (chinese) in current working directory path on wind

Post by xytroxon »

Maybe this will help...

Fix: Windows 7 Chinese characters showing up as squares
http://www.evozong.com/126

-- xytroxon
"Many computers can print only capital letters, so we shall not use lowercase letters."
-- Let's Talk Lisp (c) 1976

bairui
Posts: 64
Joined: Sun May 06, 2012 2:04 am
Location: China
Contact:

Re: utf8 (chinese) in current working directory path on wind

Post by bairui »

Thanks for the left-field thinking, xytroxon. :-)

I should have mentioned that Chinese is working in other places. I should also have mentioned that this is Win XP.

I just tested again and discovered that I can type in Chinese, even in the newLISP IDE.
If I open a file (from within the newLISP IDE) that sits in a path containing Chinese characters, then the path in the title bar contains squares. If I modify the file, I can't save it - I get an error message about the IDE not being able to save to that path (invalid path or something like that).

o_O

Oh noses... I just realised. When I was looking into your last post about the Language settings on the windows box... It said something about the Chinese on the machine being NOT utf-8. So... it's some hideous code page?

*shudder*

Windows... I thought I'd left you behind a decade ago. :-(

Ok. I have a suitable workaround for my current problem - I just move my code to C:\foo\ and everything hums tolerably.

I think I can happily sign off on this thread now. I feel like a coward walking away at this stage, but I am reminded of an AI adage - when you know a path is a fail case, there's no real benefit in pursuing it to find out exactly how bad a fail it is. I really don't know how to proceed with regard to the Chinese on the windows machine NOT being utf-8.

Thank you for your time, xytroxon and winger.

Locked