Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2010-03

source code UTF8 with BOM problems ?

7 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Luis Fernando Del Aguila Mejía

Hello, the problem is only linux.

The following source code uses UTF8 without BOM,
http://www.conoce3000.com/Ejemplo01.pp
the compiler compiles ok and the program displays the message in Unicode UTF8 ok

The following source code uses UTF8 with BOM
http://www.conoce3000.com/Ejemplo02.pp
the compiler compiles ok and the program displays the message in Unicode UTF8 with question marks.

How can I tell the compiler to ignore the BOM?

Thanks

Jonas Maebe
to Luis Fernando Del Aguila Mejía
Luis Fernando Del Aguila Mejía wrote 9 lines
The following source code uses UTF8 without BOM, http://www.conoce3000.com/Ejemplo01.pp the compiler compiles ok and the program displays the message in Unicode UTF8 ok The following source code uses UTF8 with BOM http://www.conoce3000.com/Ejemplo02.pp the compiler compiles ok and the program displays the message in Unicode UTF8 with question marks. How can I tell the compiler to ignore the BOM?

You cannot. Your first program will however only work on terminals that are configured to accept UTF-8 output. The correct way is to a) use the second program (or add {$codepage utf8} at the top of the first one)
b) add "uses cwstring;" so that a widestring manager is available, which will convert the strings (which are parsed into widestrings) to the current session's code page.

Jonas

Luis Fernando Del Aguila Mejía

Thanks, that works. but,
What is a widestring manager?

Att.
Luis Del Aguila

Luis Fernando Del Aguila Mejía

Another question.
For write programs in console or mode text.
For the source code. What charsets is appropriate to use with Free Pascal?

a) ASCII (7 bits)
b) iso-8859-1
c) Windows-1252
d) IBM 850
e) Unicode-UTF8

if your answer is (a), then :
What disadvantages does use the Unicode-UTF8?

Mattias Gaertner
to Luis Fernando Del Aguila Mejía
Show quoted text 9 lines
Another question. For write programs in console or mode text. For the source code. What charsets is appropriate to use with Free Pascal? a) ASCII (7 bits) b) iso-8859-1 c) Windows-1252 d) IBM 850 e) Unicode-UTF8

every one. whatever you like. whatever fits best.

if your answer is (a), then : What disadvantages does use the Unicode-UTF8?

what platform do you develop, what are your target platforms?

Mattias

Luis Fernando Del Aguila Mejía
> what platform do you develop, what are your target platforms?

English:
Most commonly, Linux and Windows, both 32 bits.
I want to use Unicode-UTF8 with linux and want to use Win-1252 with Windows. My question is: Is my decision right?

Spanish :
Lo más común, linux y windows, ambos 32 bits.
Deseo usar Unicode-UTF8 con linux y deseo usar Win-1252 con Windows. Mi pregunta es : ¿Es adecuada mi decisión?