[fpc-pascal] Problem with string conversion

Felipe Monteiro de Carvalho felipemonteiro.carvalho at gmail.com
Fri Oct 20 20:07:56 CEST 2006

Ok, I looked at the source code of Utf8ToUnicode and I can answer some
of my questions:

> 3) Shouldn´t we allocate Size * 2 + 2? I mean, we did not allocate
> space for the null-terminator.

Utf8ToUnicode returns a size that already counts the extra
null-terminator it appends to the string.

> 4) Here is this function on action:
> Notice the Size - 1 on the TextOutW call. If I use Size instead of
> Size -1 it will display a wrong character as the last of my string.
> Even if I clean the string filling it with zeroes before I pass it to
> the conversion unit. Why is that? Size already counts the
> null-terminator?

I confirmed that size already counts the null-terminator.

Some other questions are still unanswered, namely 2 and 5

Felipe Monteiro de Carvalho

More information about the fpc-pascal mailing list