[fpc-pascal] Funny things about utf-8 strings on mac

Felipe Monteiro de Carvalho felipemonteiro.carvalho at gmail.com
Tue Jun 12 10:00:35 CEST 2007


On 6/12/07, Jonas Maebe <jonas.maebe at elis.ugent.be> wrote:
> You said things did initially work with the UTF-8 marker in place.

I didn't say they worked. I said that the source code compiled =)

What happens is that lazarus can't handle utf-8, so I open
TextWrangler, edit the strings, close it, and go back to working with
Lazarus.

I did some more tests. This time I didn't open the source file with
Lazarus, to make sure that it doesn't alter it.

When I use TextWrangler to save my file to UTF-8, the utf-8 strings
don't work. If I set it to save my file as UTF-8 without BOM, they
work.

> The default code page used by FPC is 8859-1. However, the scanner
> detects the UTF-8 marker if present, and when it finds it then it
> switches the code page to UTF-8. You can also set the code page
> manually to UTF-8 using {$codepage utf-8}.

Why does the codepage matter in this case? I would imagine that FPC
just reads my string as a bunch of bytes... fpc doesn't need to
perform any operations with it.

-- 
Felipe Monteiro de Carvalho



More information about the fpc-pascal mailing list