Forum > Beginners

Which string type is default ?

(1/1)

jack_:
I've read all from website:
http://wiki.lazarus.freepascal.org/Character_and_string_types

Which string type should I use as a default for international language support on Linux [Lubuntu 14.04] ??
I don't need Chinese support - I think about European languages - my is Polish.

I've created a command-line example and I've used AnsiString and all looks fine - but is it default type for UTF8??
I will be working with MySQL[MariaDB exactly] in which I've set all settings to UTF8.
There will be also web front-end on Nginx and PHP with UTF8 settings.

My system locale:
root@lubuntudev-1-0:/etc/default# cat locale
LANG="en_US.UTF-8"
LC_NUMERIC="pl_PL.UTF-8"
LC_TIME="pl_PL.UTF-8"
LC_MONETARY="pl_PL.UTF-8"
LC_PAPER="pl_PL.UTF-8"
LC_NAME="pl_PL.UTF-8"
LC_ADDRESS="pl_PL.UTF-8"
LC_TELEPHONE="pl_PL.UTF-8"
LC_MEASUREMENT="pl_PL.UTF-8"
LC_IDENTIFICATION="pl_PL.UTF-8"

hinst:
In FPC 2.6.x you can just use string as UTF-8 string in this case // & most cases

I currently happen to work on an application which uses MySQL database, and I use UTF-8 encoding as well. I just put "string" everywhere. _everywhere_. And it works just fine. Strings get stored and retrieved in correct encoding; they also look correct from MySQL admin utility even when I store non-latin characters. When you use utf-8 encoding it does not depend on system locale, that is what good & useful about it

P.S. I use standard fcl-db library to access DB
 ---
So you should be fine with just string
 ---
Not sure about FPC 2.7.x though, I read that strings in FPC 2.7.x behave not like in 2.6.x
 
 --- --- ---
anyway, this text from wiki page explains UTF8String clear enough:

--- Code: ---Currently, the type UTF8String is an alias to the type AnsiString. It is meant to contain UTF8 encoded strings (i.e. unicode data ranging from 1..4 bytes per character). UTF8String is the default string in Lazarus and LCL.
--- End code ---

Navigation

[0] Message Index

Go to full version