Re: [Lazarus] Problem with non-ascii chars fpc-3.0.0 vs fpc-3.1.1 under Windows
On 04/27/2016 09:00 PM, Mattias Gaertner wrote: On Wed, 27 Apr 2016 20:30:43 +0200 zeljkowrote: Hi, Just run into problem with fpc-3.0.0, OS Windows-10 64bit, 32bit application, lazarus trunk qtlcl and win32 ws both have same problem. fpc-3.1.1 (18.01.2016) is correct - both running from lazarus or as standalone. fpc-3.0.0 is not correct in both cases (even worse if running from lazarus, then GetEnvironmentVariableUTF8 returns garbage instead of letter Ž. fpc-2.6.4 - works just fine. My project doesn't use anything special - pure empty project with one form and TMemo - no extra settings like -FcUTF8 or similar, using mode delphi Problematic part is line with CACHEDIR= (see screenshoots) which is correct with 3.1.1 and it returns correct path from this function: function GetCacheDir_: String; {$IFDEF MSWINDOWS} var s: string; s1: string; {$ENDIF} begin {$IFDEF UNIX} Result := GetEnvironmentVariable('HOME') + PathDelim + '.holobit'; {$ELSE} // fpc-3.1.1 returns correct values here, while fpc-3.0.0 NOT // if environmentvariable contains non-ascii chars s := GetEnvironmentVariable('HOMEDRIVE'); // added s := s+ to fit into mail ... s := s + GetEnvironmentVariable('HOMEPATH')+PathDelim+'.holobit'; SetLength(s1, length(s)); OEMToAnsiBuff(@S[1], @S1[1], length(S1)); OEMToAnsiBuff expects a string in DOS codepage and returns a string in Windows codepage. Yes, I know that ,but that's not problem...look below... GetEnvironmentVariableUTF8 returns an UTF-8 encoded string. What encoding do you need for the function result? UTF-8, but question is why 3.1.1 (and 2.6.4) returns correct result but 3.0.0 NOT with same project and same settings. Another thing is that project when running from IDE with fpc-3.0.0 doesn't get correct result even for GetEnvironmentVariableUTF8(), while 3.1.1 is correct again. zeljko -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Problem with non-ascii chars fpc-3.0.0 vs fpc-3.1.1 under Windows
On Wed, 27 Apr 2016 20:30:43 +0200 zeljkowrote: > Hi, > Just run into problem with fpc-3.0.0, OS Windows-10 64bit, 32bit > application, lazarus trunk qtlcl and win32 ws both have same problem. > > fpc-3.1.1 (18.01.2016) is correct - both running from lazarus or as > standalone. > > fpc-3.0.0 is not correct in both cases (even worse if running from > lazarus, then GetEnvironmentVariableUTF8 returns garbage instead of > letter Ž. > > fpc-2.6.4 - works just fine. > > > My project doesn't use anything special - pure empty project with one > form and TMemo - no extra settings like -FcUTF8 or similar, using mode > delphi > > Problematic part is line with CACHEDIR= (see screenshoots) which is > correct with 3.1.1 and it returns correct path from this function: > > function GetCacheDir_: String; > {$IFDEF MSWINDOWS} > var >s: string; >s1: string; > {$ENDIF} > begin >{$IFDEF UNIX} >Result := GetEnvironmentVariable('HOME') + PathDelim + '.holobit'; >{$ELSE} >// fpc-3.1.1 returns correct values here, while fpc-3.0.0 NOT >// if environmentvariable contains non-ascii chars >s := GetEnvironmentVariable('HOMEDRIVE'); >// added s := s+ to fit into mail ... >s := s + GetEnvironmentVariable('HOMEPATH')+PathDelim+'.holobit'; >SetLength(s1, length(s)); >OEMToAnsiBuff(@S[1], @S1[1], length(S1)); OEMToAnsiBuff expects a string in DOS codepage and returns a string in Windows codepage. GetEnvironmentVariableUTF8 returns an UTF-8 encoded string. What encoding do you need for the function result? >Result := S1; >{$ENDIF} > end; > > So, my question would be: is it known bug in 3.0.0 and will be fixed in > 3.0.2 or it's already merged in fixes_3_0 or I can sit and cry...or I'm > missing something ? Mattias -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] Problem with non-ascii chars fpc-3.0.0 vs fpc-3.1.1 under Windows
Hi, Just run into problem with fpc-3.0.0, OS Windows-10 64bit, 32bit application, lazarus trunk qtlcl and win32 ws both have same problem. fpc-3.1.1 (18.01.2016) is correct - both running from lazarus or as standalone. fpc-3.0.0 is not correct in both cases (even worse if running from lazarus, then GetEnvironmentVariableUTF8 returns garbage instead of letter Ž. fpc-2.6.4 - works just fine. My project doesn't use anything special - pure empty project with one form and TMemo - no extra settings like -FcUTF8 or similar, using mode delphi Problematic part is line with CACHEDIR= (see screenshoots) which is correct with 3.1.1 and it returns correct path from this function: function GetCacheDir_: String; {$IFDEF MSWINDOWS} var s: string; s1: string; {$ENDIF} begin {$IFDEF UNIX} Result := GetEnvironmentVariable('HOME') + PathDelim + '.holobit'; {$ELSE} // fpc-3.1.1 returns correct values here, while fpc-3.0.0 NOT // if environmentvariable contains non-ascii chars s := GetEnvironmentVariable('HOMEDRIVE'); // added s := s+ to fit into mail ... s := s + GetEnvironmentVariable('HOMEPATH')+PathDelim+'.holobit'; SetLength(s1, length(s)); OEMToAnsiBuff(@S[1], @S1[1], length(S1)); Result := S1; {$ENDIF} end; So, my question would be: is it known bug in 3.0.0 and will be fixed in 3.0.2 or it's already merged in fixes_3_0 or I can sit and cry...or I'm missing something ? Thanks zeljko -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus