ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
From some time now, I've been doing multiplatform programming using Qt/C++. My IDE of choice is qtcreator, though I don't feel particularly tied to it since I don't use the UI creator part, whatever that was called.
I've been using utf-8 for quite a few years in Linux, which is my primary (and almost-only) platform.
My locale is es_ES@UTF-8.
The problem is that some of my customers like working in Xp, which means problems when it comes to utf-8 in any languages that's not plain English.
I discovered it the hard way, and now I am in a situation where I have to go converting the encoding of the source files every now and then between utf-8 and iso-8859-15, and then back, which can be quite tedious.
How do people handle this kind of stuff? It seems a trivial thing but I can't find anything about this, and after more than one year of developing this way it has become quite time consuming, even with automation scripts, besides it's also error prone.
For sources usually I use the standard ASCII char set, nothing more. I do not care about any language specific characters, just replace them with a "normal" one. There is no way to avoid problems (caused by those chars).
(I build softwares for almost 20 years, containing parts in spanish, hungarian, german, swedish..., and using java, c, c++, scripts and other languages, on windows/solaris/linux. There is no other way but removing strange chars)
Well, in the sources, at some point you will need to write a string or something that will end in the interface.
Intentionally exposing typos to the final users is not something I am willing to do. I'd rather continue this maintenance burden that I have right now or implement something myself when/if I get to the point where I can't stand this anymore.
It just seems odd to me that by now there's no sane way to handle this...
You could play around with BOM but it has it's own set of problems.
I am not sure how this can help me, care to elaborate?
Or maybe you didn't understand my problem. The issue is with the encoding of the source files. If I save then as utd8 and then compile them the strings won't show properly when you run the .exe in xp. If the source files are saved with iso-8859-15 then the resulting binary works as intended.
I am not sure how this can help me, care to elaborate?
If you add UTF-8 BOM to the file some Windows applications should read the file as UTF-8. But like I mentioned, this solution may introduce other problems and it may not work for some other applications.
Quote:
Originally Posted by i92guboj
Well, in the sources, at some point you will need to write a string or something that will end in the interface.
Depending on the language, you can escape Unicode characters with “\u####” or similar sequence though. This would be rather cumbersome to do manually though, so perhaps your editor could assist you with that automatically converting non-ASCII characters in strings to escaped sequence.
That I figured. But it wouldn@t help with binaries, would it?
I am not interested in opening source files in windows. I develop fully in linux. What i want is that when it comes the time to launch the exe in windows I'll be able to see accented characters and euro symbols that are hardcoded in the sources, and not some kind of random crap.
Well, in the sources, at some point you will need to write a string or something that will end in the interface.
No you must not do that. All the displayed texts should be collected and put into some "external" files and you only need to use indices in the sources.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.