Forum > Databases

TDBMemo mistranslating ASCII 248

(1/2) > >>

RedOctober:
Platform: 
Windows Server 2016, Lazarus 2.0.20, FPC 3.2.0, IBX 2.3-4
Firebird  v3.0.73
Database Character Set:  WIN1252

Lazarus Application problem field linkage:
-- Interface --
TDBMemo
TIBMemoField
TIBDataSet
FireBird BLOB field (CREATE DOMAIN DOM_NOTE AS BLOB SUB_TYPE TEXT SEGMENT SIZE 80 CHARACTER SET WIN1252;)
-- Backend --

Problem description:

The TDBMemo is unable to properly save a degree symbol (ASCII 248). When entered in the user interface, by holding down the Alt key, then typing 248, the degree symbol appears. I save the record and reopen the record and there is a funny capital A with a squiggle over top of it, just to the left of the degree symbol.  That unwanted A character is the problem.  It should not be there.


Attempts to localize the problem:

When I use my database management tool, (FireBolt) I can use an UPDATE statement to save the degree symbol to the same field, successfully. It then displays correctly in FireBolt. When I use the UPDATE statement in FireBolt, and the degree symbol is successfully saved and showing correctly in FireBolt, when I refresh the record in my Lazarus app, the TDBMemo field shows the degree symbol correctly.
I can successfully save and retrieve a degree symbol in an TIBString field, but in a TDBMemo, I cannot. I get that extra funny A character when using a TDBMemo.
The above tests, tells me that there is a problem with saving (only), from a TDBMemo to a TIBMemoField. Loading the TDBMemo from a TIBMemoField works correctly.
The problem is not with the Firebird database.

Attempts to fix the problem:
I examined the properties of the TIBMemoField, and found one setting that I thought might be involved: Transliterate.  It was set to OFF.  I set it ON and compiled and re-ran my test.  The problem persists.  The funny A character appears in the backend field as well as the TDBMemo control when saving.


Question:
What do I need to do, to get the TDBMemo to properly save a degree symbol, ASCII 248 ?

Thanks in advance for any help you can provide.

Jurassic Pork:
Hello,

--- Quote from: RedOctober on August 12, 2022, 05:23:41 pm ---The TDBMemo is unable to properly save a degree symbol (ASCII 248).

--- End quote ---
Are you sure that  248 is the degree symbol. On my computer it's the o with slash character ->  ø
I have no problem to use this character in my firebird database mushrooms coming with the lazarus database examples  in my TDBMemo field Note (see attachments). But the charset of the database is UTF8.
Friendly, J.P

RedOctober:
Hi Jurrassic, yes I'm sure 248 is the degree symbol.  Here it is here:  °

Also shown here on the ASCII chart:

https://theasciicode.com.ar/extended-ascii-code/degree-symbol-ascii-code-248.html

Also, in my original post, I said that my TDBEdit fields can properly store and retrieve this character.  I produce it by holding down my ALT key + 248 on the number pad.

Jurassic Pork:

--- Quote from: RedOctober on August 13, 2022, 03:28:17 am ---Hi Jurrassic, yes I'm sure 248 is the degree symbol.  Here it is here:  °
Also, in my original post, I said that my TDBEdit fields can properly store and retrieve this character.  I produce it by holding down my ALT key + 248 on the number pad.

--- End quote ---
° is ALT+0176
ø is ALT+0248
see Attachment (click on picture to start animation)

Friendly, J.P

MarkMLl:

--- Quote from: Jurassic Pork on August 13, 2022, 08:48:36 am ---° is ALT+0176

--- End quote ---

176 in the Unicode encoding, and OP's description suggests that he's getting a UTF-8 sequence back from the database even though he doesn't investigate what that actually is ("funny capital A with a squiggle over top of it" isn't a very good description of a problem).

There's multiple things here: data entry of the correct character, potential conversion by database libraries, storage/retrieval by the backend database, potential conversion by database libraries, and final display by the TDBMemo.

MarkMLl

p.s. There is really no such thing as "ASCII 248".

Navigation

[0] Message Index

[#] Next page

Go to full version