views:

416

answers:

3

Hi

(Ive looked at the other questions - none seemed to quite fit my problem.)

I have some file-names under Windows 7 that need to be translated in to MySQL database (UTF-8) with Ruby on Rails.

An example file-name includes "íéó" in some kind of Windows 7 file-system encoding.

Ive tried many combinations of gsub and ActiveSupport::Multibyte::Chars.

Thanks for the help

A: 

If you use Notepad++ you have the option of converting a file. http://notepad-plus.sourceforge.net

It is under the menu item: encoding.

PlanetMaster
Thanks - but the file-encoding isn't the problem - its the file-name's encoding.
Reilly
ok, sorry, don't know the answer then.
PlanetMaster
A: 

I've been using Windows for many years now, since Windows 3.1 and Windows NT 4.0, but I still don't fully understand how Windows handles filename encodings. And I have been using MRI and YARV on Windows for several years and I still don't understand how they handle filename encodings on Windows.

What I do know is that there are some problems with Unicode filenames on Windows that will be fixed in 1.9.2. However, I don't know whether that actually is the problem that you are hitting or if there is just a plain bug in your code.

Jörg W Mittag
+1  A: 

Have you tried calling WideCharacterToMultiByte specifying CP_UTF8? That's the normal way of converting from UCS2 to UTF8 on Windows.

Larry Osterman