TotalCross / totalcross

TotalCross is a Software Development Kit that helps cross platform application development. Currently supported platforms are: Windows, Wince, Android, iOS, Linux and Linux ARM for embedded systems.
https://www.totalcross.com
GNU Lesser General Public License v2.1
222 stars 40 forks source link

Special characters returned by SQLITE, are breaking, but not when used directly in the code #257

Open VicMisael opened 3 years ago

VicMisael commented 3 years ago

Describe the bug

When using sqlite to return a string, it breaks on all versions from 5.1.4 to the branch release/7.0.0

To Reproduce

Just compile the following code and run it on Android

Sqlite.zip

Expected behavior

The especial characters should work as is on inputing the text directly to the label

Screenshots or videos

image

Devices:

Please complete the following information:

VicMisael commented 3 years ago

Also reproducible using win32 image On the simulator: image

VicMisael commented 3 years ago

Doing some tests on windows,It seems like when deployed to some platforms, it uses a different set of bytes for String on Sqlite, this may be related to encoding of characters on sqlite.

I modified the code that I sent to print every set of bytes for each Char on the string(On windows it will write to a file)

Using ordinary java String

aáãíííí 0x0061 0x00E1 0x00E3 0x00ED 0x00ED 0x00ED 0x00ED

Retrieving from sqlite

aýýýýýý 0x0061 0x003F 0x003F 0x003F 0x003F 0x003F 0x003F

VicMisael commented 3 years ago

The issue is also present on Linux_ARM, so maybe related to all platforms(Not tested on Ios neither Linux_x86)

a������ 0x0061 0x00E1 0x00E3 0x00ED 0x00ED 0x00ED 0x00ED Total ST12.3 0x0054 0x006F 0x0074 0x0061 0x006C 0x0020 0x0053 0x0054 Total L�quido + ST12.3 0x0054 0x006F 0x0074 0x0061 0x006C 0x0020 0x004C 0x003F 0x0071 0x0075 0x0069 0x0064 0x006F 0x0020 0x002B 0x0020 0x0053 0x0054 Total L�quido + ST + IPI24.6 0x0054 0x006F 0x0074 0x0061 0x006C 0x0020 0x004C 0x003F 0x0071 0x0075 0x0069 0x0064 0x006F 0x0020 0x002B 0x0020 0x0053 0x0054 0x0020 0x002B 0x0020 0x0049 0x0050 0x0049 Valor total fat.12.3 0x0056 0x0061 0x006C 0x006F 0x0072 0x0020 0x0074 0x006F 0x0074 0x0061 0x006C 0x0020 0x0066 0x0061 0x0074 0x002E a������24.6 0x0061 0x003F 0x003F 0x003F 0x003F 0x003F 0x003F

the bytes outputed are the same on win32

2021-01-08-125554_1440x900_scrot