Lazarus
Programming => Databases => Topic started by: 3rdshiftcoder on April 23, 2018, 03:38:48 am
-
Hi-
I spent tonight teaching myself a little about charsets. I wonder with tibconnection how to protect controls so only utf8 characters can get accepted. I read where someone chose these for zeos zconnection but don't know if they are the same:
http://forum.lazarus-ide.org/index.php?topic=33741.0 (http://forum.lazarus-ide.org/index.php?topic=33741.0)
codepage=UTF8
controls_cp=CP_UTF8
Also, do I have to set anything with the font for charset?
I can put charset in object inspector property for tibconnection as: UTF8.
I also looked at encoding by right clicking in editor and looking at file settings and encoding.
Thx. for any tricks and letting me know correct settings for tibconnection param or where I can find that info.
I am interested if the right settings will block the controls from getting invalid data. For instance 1252 is only supposed to match utf8 for ascii characters so like what if someone wanted to type 1252 data that didn't match utf8 from the clipboard!
I noticed if I put the params in tibconnection in wrong from above the code still ran without any warnings.
Have cool week,
3rdshiftcoder
-
It all depends on how deep you want to learn about glyphs, character sets, charmap, locales, collation and Unicode.
https://en.wikipedia.org/wiki/Category:Character_sets
https://en.wikipedia.org/wiki/Category:Character_encoding
https://en.wikipedia.org/wiki/Category:Unicode
Then you have to learn how each OS (Windows, Linux, Mac, etc), programing languages, IDE and tools (Free Pascal, Lazarus, etc), (Relational) Database Systems (RDBMS) implement and deal with glyphs, character sets, collation and Unicode.
Some very basic and initial information:
https://en.wikipedia.org/wiki/Windows_code_page
https://en.wikipedia.org/wiki/Unicode_in_Microsoft_Windows
http://wiki.freepascal.org/Unicode_Support_in_Lazarus
http://wiki.freepascal.org/FPC_Unicode_support
https://firebirdsql.org/file/documentation/reference_manuals/fblangref25-en/html/fblangref25-appx06-charsets.html
https://www.firebirdsql.org/en/documentation/
Also, do I have to set anything with the font for charset?
Yes, on Firebird you can set default charset and collation when creating the database or the table.
https://firebirdsql.org/refdocs/langrefupd25-ddl-database.html
https://firebirdsql.org/file/documentation/reference_manuals/fblangref25-en/html/fblangref25-ddl-tbl.html
https://firebirdsql.org/refdocs/langrefupd25-select.html
Even if you didn't define it previously, you can define or change collation on a simple select:
https://firebirdsql.org/refdocs/langrefupd25-select.html#langrefupd25-select-collate
Thx. for any tricks and letting me know correct settings for tibconnection param or where I can find that info.
I am interested if the right settings will block the controls from getting invalid data. For instance 1252 is only supposed to match utf8 for ascii characters so like what if someone wanted to type 1252 data that didn't match utf8 from the clipboard!
We don't think as block this kind of stuff, we think as put all pieces correctly together.
There are cases when we'll have to convert from on character set to another, for example:
Lazarus - SQL Server data are in Greek characters not unicode
http://forum.lazarus-ide.org/index.php/topic,35554.msg235223.html#msg235223
TEncoding.GetEncoding with memo
http://forum.lazarus-ide.org/index.php/topic,33231.msg215097.html#msg215097
fpspreadsheet large file
http://forum.lazarus-ide.org/index.php/topic,25885.msg158498.html#msg158498
Encoding problems
http://forum.lazarus.freepascal.org/index.php/topic,38383.msg260416.html#msg260416
Accented letters in a TStringlist
http://forum.lazarus.freepascal.org/index.php/topic,40594.msg280484.html#msg280484
Codepage, convert Ansi to Utf8
https://forum.lazarus.freepascal.org/index.php?topic=33513.15
Converting File Stream From UTF-16 LE to UTF-8 By UTF8Tools
http://forum.lazarus.freepascal.org/index.php?topic=30553.0
Trying to get My Documents folder
http://forum.lazarus.freepascal.org/index.php/topic,37602.msg253281.html#msg253281
-
It will be easier and faster to help you if attach a small sample project with a specific problem.
-
Hi Valdir-
What a cool response. Thx for taking the time to post. I am sitting here reading some of these links thinking about the very cool information at hand.
Have a cool week . :)
jim