Ruby 1.8 - character encoding

  • Thread starter Thomas Thomassen
  • Start date
B

Bill Kelly

From: "Bill Kelly said:
For best 8-bit compatibility you'll want to encode to Windows1252.

Hmm, I take it back; even for 8-bit it appears slightly more complicated
on windows...

Apparently depending on AreFileApisANSI() one would encode to
GetACP() vs. GetOEMCP()

Ruby 1.9.1 is smart enough to handle this automatically (see:
rb_filesystem_encoding() in encoding.c)

But anyway this is all still referring to 8-bit code pages and still won't
help for chinese (etc.) characters anyway...

* * *

So, again, if you absolutely need to handle unicode paths on
windows prior to ruby 1.9.2, and you don't have the option of
writing your own ruby C extension, the I think trying to call
wide-character functions like _wopen() via ruby's Win32API
module may be the only option. :(


Regards,

Bill
 
T

Thomas Thomassen

Ok. Thanks for the feedback. This gives me some pointers to where I
should start looking.
I looks like that unless I can find a way to call UTF-8 aware file
methods the plugins are doomed to run into bugs and malfunction.
I'll dig into Windows' Unicode capable API and query the Sketchup
scripting and plugin community and see if we can find a solution. Maybe
Google Sketchup devs can provide some assistance as well.
 
T

Thomas Thomassen

Bill said:
Unlike that other OS, both OS X and Linux have taken an approach
I like to refer to as, NOT MIND-NUMBINGLY STUPID.

In OS X and Linux, one can use the same API calls one has always
used, as they are now UTF-8 savvy.
I found from the Windows API that you actually are meant to call the
same API calls. But there's a unicode switch you have to declare. If
that switch is true it calls the W (wide - unicode) versions, if not it
calls the A (ASCII) versions.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top