[fpc-pascal] UTF8Decode

Jonas Maebe jonas.maebe at elis.ugent.be
Mon May 10 23:35:15 CEST 2010


On 10 May 2010, at 23:25, Luis Fernando Del Aguila Mejía wrote:

> When compiling this program http://www.conoce3000.com/Test.pp in Windows receive the following error:
> Test.pp(4,11) Error: Can't determine which overloaded function to call
> The problem only happens when I use a utf8 character.
> What am I doing wrong?
> In Linux, the program compile OK. 

If you compile with -vh, then the compiler will tell you which function definitions it found:

tt.pp(4,11) Error: Can't determine which overloaded function to call
wstrings.inc(1623,10) Hint: Found declaration: UTF8Encode(const WideString):AnsiString;
ustrings.inc(2281,10) Hint: Found declaration: UTF8Encode(const UnicodeString):AnsiString;

The reason it works on Unix platforms, is that widestring=unicodestring there (so there is nothing to choose between if you pass a wide/unicodechar). You can solve it by typecasting the character explicitly to either widestring or unicodestring.


Jonas


More information about the fpc-pascal mailing list