ISO-8859-1 in GTK2 (linux) lazarus / 13-General ---------------------------------------------------------------------- chrnobel · 2008-10-06 09:10 I am making a web application with POWtils, where I am going to use ISO-8859-1, so I am 100% sure that the data entered on the website, and then stored in my MySQL database is in a format where data can easily be exported to another database running on Windows. As this Windows application is not UTF, I am not interested in converting data when exporting (also some Delphi programs needs access to the database, and as thise are written in D5, and I am not interested in buying a new Delphi, this makes some restrictions). So therefore I am stuck with 8859, as the webpage also shall be able to handle Danish characters like æøå. My problem is now that if I want use Lazarus with GTK2 it is not possible to edit 8859 (even if i have my locales set to da_DK.ISO-8859-1), but if I use GTK1 it is possible - however I prefer GTK2 because the interface is much nicer, and I do not want to recompile back and forth everytime I switch between making a GUI and a non GUI application. If I use an external editor like Bluefish one can easily switch whether the document shall be in UTF or 8859, but this facility lacks in Lazarus' editor (and as I like code completion, using Bluefish is not at way to go). So does anyone have a suggestion how to solve this problem. Regards Chris ---------------------------------------------------------------------- dav999 · 2008-10-20 19:22 Hello, my english is not very good, but if i have understand your request, you can test this code to converting a textfile in 8859 to utf : i'm in ubuntu and this code works : "chemin_du_fichier" is a global variable i store in the path of my file Code: [Select]var Aprocess : Tprocess;     Astringlist : Tstringlist; begin //içi on va vérifier que le fichier est bien en encodage ISO-8859 (version windows) //dans ce cas on va le convertir avec le prog "recode" en UTF-8 (ce qui évite d'avoir //les erreurs de convertion windows/linux    AProcess := TProcess.Create(nil);    AStringList := TStringList.Create;    //ATTENTION à bien mettre les trema sinon il y aura un message d'erreur car les chemins    //avec un espace ne seront pas bien reconnus !!!!    AProcess.CommandLine := 'file "' + chemin_du_fichier + '"';    AProcess.Options := AProcess.Options + [poWaitOnExit, poUsePipes];    //showmessage(aprocess.CommandLine);    AProcess.Execute;    AStringList.LoadFromStream(AProcess.Output);    AProcess.Free;    AProcess := TProcess.Create(nil);    AProcess.Options := AProcess.Options + [poWaitOnExit];      //showmessage(astringlist.Text);    if findpart('8859-15',astringlist.Text) <> 0 then      begin      AProcess.CommandLine := 'recode iso-8859-15..utf-8 "' + chemin_du_fichier + '"';      AProcess.Execute;      end     else if findpart('8859 t',astringlist.Text) <> 0 then      begin      AProcess.CommandLine := 'recode iso-8859..utf-8 "' + chemin_du_fichier + '"';      AProcess.Execute;      end;      AProcess.Free;    AStringList.Free; end; Bye David ---------------------------------------------------------------------- chrnobel · 2008-10-21 06:34 Hi David. No the problem is not just converting a textfile, that is relatively straight forward. The problem is that the IDE in it self is (now) pure UTF8, which is ok in many situations, but as I am making an application that shall work together with other Windows programs (which still is sooo primitive with regards to UTF), it requires everything to be ISO-8859-1, including the editor of the IDE. /Chris ---------------------------------------------------------------------- dav999 · 2008-10-21 07:11 ok, excuse for my response your problem is harder that i think ---------------------------------------------------------------------- chrnobel · 2008-10-21 08:46 Hi David. You don't have to excuse   , it is of course very positive with all kind of replies, and your suggestion can be usefull in other scenarios. /Chris