french accent ( é,è, etc) lazarus / 1-Linux ---------------------------------------------------------------------- neodivx · 2008-01-12 14:02 Hi alls, i'm working on lazarus in linux and windows, making a same program for both environment. I have a problem with the accent in french. for exemple, when i open a dialog box for saving a file, i have a 'répertoire' ( directory ). The problem is the following: when i'm on linux, everything'll working perfeclty ( i have the 'répertoire' ) but on windows i have something like that ( R!@#pertoire how do i correct that in french. thanks for your help ---------------------------------------------------------------------- felipemdc · 2008-01-12 19:01 The problem is that by default, at the moment, windows and linux version use different encodings internally. Linux will most often use utf-8, and windows uses iso. We have a almost fully functional windows unicode version but it isn't on by default. You can turn it on manually. I think your problem will be fixed if you download Lazarus from subversion, rebuild it with -dWindowsUnicodeSupport activated and rebuild your windows application. All steps are documented on the wiki: http://wiki.lazarus.freepascal.org/Installing_Lazarus#Installing_from_ source_2 http://wiki.lazarus.freepascal.org/Getting_Lazarus#Development_version s_from_SVN http://wiki.lazarus.freepascal.org/LCL_Unicode_Support#Compiling_LCL- Win32_with_Unicode ---------------------------------------------------------------------- neodivx · 2008-01-12 20:30 thanks for you help, it's working for windows. ---------------------------------------------------------------------- bonmario · 2008-01-20 18:40 After the rebuild with the option -dWindowsUnicodeSupport how convert old sources from ASCII to Unicode? There is a tool fot it? Thanks, Mario ---------------------------------------------------------------------- pch · 2008-01-22 10:38 On Linux the iconv command do the job, maybe you can find a version for Windows or an equivalent program. ---------------------------------------------------------------------- felipemdc · 2008-01-24 17:39 Quote from: "bonmario"After the rebuild with the option -dWindowsUnicodeSupport how convert old sources from ASCII to Unicode? There is a tool fot it? Open in a editor which can read both formats and save on the new format. For Linux there are lot's: kate, gedit On Windows I think Notepad++ can do that On Mac OS X there is Text Wrangler. ---------------------------------------------------------------------- bonmario · 2008-01-24 18:27 Quote from: "sekel"Open in a editor which can read both formats and save on the new format. For Linux there are lot's: kate, gedit On Windows I think Notepad++ can do that On Mac OS X there is Text Wrangler. I have more than 100 sources ---------------------------------------------------------------------- Vincent Snijders · 2008-01-25 08:46 I see that for you it is worthwhile to write a conversion plug-in for Lazarus. I am looking forward to your contribution :-) ---------------------------------------------------------------------- bonmario · 2008-01-25 10:26 Quote from: "Vincent"I see that for you it is worthwhile to write a conversion plug-in for Lazarus. I am looking forward to your contribution :-) I'm trying to convert my sources, but i think that this is not the best solution, also because i'm doing a conversion from ASCII italian to unicode for the characters between #128 and #255 and don't know if this may be useful for someone that use another codepage. How i wrote here http://bugs.freepascal.org/view.php?id=10652 i think that there is a problem is in the IDE on Windows, because it hides lines with these chars. On Linux the same sources shows bad characters, but for me it is a good compromise. Also because when i will use a source wrote from another i wll ave the same problems (see the images attached at bugreport) Hi, Mario ---------------------------------------------------------------------- felipemdc · 2008-02-02 09:12 Quote from: "bonmario"I'm trying to convert my sources, but i think that this is not the best solution, also because i'm doing a conversion from ASCII italian to unicode for the characters between #128 and #255 and don't know if this may be useful for someone that use another codepage. If you extend the IDE to be able to convert your source code from one encoding to another, this will be very useful. You can even start with just the conversion that you need, which is iso 8859-1 (latin 1) to utf-8. After this is ready, extending it to be able to handle other encodings is very easy. Not to mention that lot's of languages fall into latin 1. I'm not exactly sure how this could be done, and it also depends if we will support just setting the encoding for all source of the project or setting it per-file. ---------------------------------------------------------------------- bonmario · 2008-02-12 20:18 Quote from: "Vincent"I see that for you it is worthwhile to write a conversion plug-in for Lazarus. I am looking forward to your contribution :-) Save this code as "BonMarConvUtf.pas": Code: [Select] unit BonMarConvUtf; {$Mode Objfpc}{$H+} interface   function  Ascii2Utf8(St:String):String; implementation     function  Ascii2Utf8(St:String):String;   var Idx, OrdChr:Integer;   begin     Result:='';         for Idx:=1 to Length(St) do begin       case St[Idx] of         #000..#127: Result:=Result + St[Idx];         #128..#191: Result:=Result + #194 + St[Idx];         #192..#255: begin                       OrdChr:=Ord(St[Idx]) - 192 + 128;                       Result:=Result + #195 + Chr(OrdChr);                     end;       end;     end;   end; end. I made and used this unit to convert my sources from ASCII (italian) to UTF-8 I hope that this code will be useful from someone. Hi, Mario