1. How to read an save with charSet UTF-8 ?
- Posted by sergelli Mar 28, 2011
- 1679 views
Good morning to all
I have several programs written in Euphoria 3.11 and Win32Lib 0.70.4a. They always worked fine, but now appearing occasions where the work requires charSet UTF-8. I tried fix it, but I not understand the work on UTF-8 posted on users contributions.
Because of this, I'm having problems and can no longer use my programs written in Euphoria.
Could you please help me providing a sample program that reads and writes files in UTF-8 charset?
Thank you in advance
2. Re: How to read an save with charSet UTF-8 ?
- Posted by mattlewis (admin) Mar 28, 2011
- 1739 views
Good morning to all
I have several programs written in Euphoria 3.11 and Win32Lib 0.70.4a. They always worked fine, but now appearing occasions where the work requires charSet UTF-8. I tried fix it, but I not understand the work on UTF-8 posted on users contributions.
Because of this, I'm having problems and can no longer use my programs written in Euphoria.
Could you please help me providing a sample program that reads and writes files in UTF-8 charset?
You can use MultiByteToWideChar to convert from UTF-8 to UTF-16. Then use WideCharToMultiByte to convert back to whatever code page you're interested in. EuCOM has a file, unicode.ew that uses these functions if you want to see examples of using them.
There's also a UTF-8 to ASCII converter in the archive that might work for what you need.
Matt
3. Re: How to read an save with charSet UTF-8 ?
- Posted by sergelli Mar 28, 2011
- 1702 views
There's also a UTF-8 to ASCII converter in the archive that might work for what you need. Matt
Thanks Matt
The solution to this problem lies in change UTF-8 characters when reading a file and switch to UTF-8 characters when saving a file ?
4. Re: How to read an save with charSet UTF-8 ?
- Posted by mattlewis (admin) Mar 28, 2011
- 1715 views
There's also a UTF-8 to ASCII converter in the archive that might work for what you need. Matt
Thanks Matt
The solution to this problem lies in change UTF-8 characters when reading a file and switch to UTF-8 characters when saving a file ?
Sort of. ASCII characters are all valid UTF-8 characters as-is. You might be losing information on the conversion when you read it in. I don't know what the converter would do with other characters (I haven't looked at it very closely). Also, using win32lib, you won't be able to display them, since it uses all ANSI style Win32 functions.
I couldn't say if this is good enough for your application.
<shameless-plug>One alternative, which would take a bit of owrk, is to convert your application use wxEuphoria, which uses unicode by default, and has functions to convert UTF-8 to its native (UTF-16) encoding and back. It handles the display, etc, of non-ASCII characters just fine, but there could be a lot of conversion for you to do, plus the extra DLL that your application would require. </shameless-plug>
Matt
5. Re: How to read an save with charSet UTF-8 ?
- Posted by sergelli Mar 28, 2011
- 1679 views
<shameless-plug>One alternative, which would take a bit of owrk, is to convert your application use wxEuphoria, Matt
I'm using Mandriva Linux for many years and run all Euphoria applications with Wine (runs fine).
I tried using the vxEuphoria (under Linux) about 3 years ago, but something went wrong this time. I do not tryed under Wine nor Windows.
I do not remember well, maybe not had access to the correct versions of programs (besides VxEuphoria) that must also be installed.
I'll try again later.
6. Re: How to read an save with charSet UTF-8 ?
- Posted by mattlewis (admin) Mar 28, 2011
- 1678 views
I'm using Mandriva Linux for many years and run all Euphoria applications with Wine (runs fine).
I tried using the vxEuphoria (under Linux) about 3 years ago, but something went wrong this time. I do not tryed under Wine nor Windows.
I do not remember well, maybe not had access to the correct versions of programs (besides VxEuphoria) that must also be installed.
I'll try again later.
It's possible that you'll need to build the wxEuphoria libraries yourself. Note that on Linux, wxEuphoria generally uses the system's wxWidgets libraries. I've heard that some distros ship with ANSI builds of wxWidgets, which would mean that you'd need to build those yourself, too, with a unicode build, in order to get unicode functionality.
I've never tried running the Windows version of wxEuphoria under wine.
Matt