JDP Science Tools

cancel
Showing results for 
Search instead for 
Did you mean: 

sqlite UTF-8 on Linux (as a service)

Solved!
Go to solution

I've been using sqlite lib on Linux (i compile my app as a shared library and run it as a service in a dicker container) for a few years and all was good until I had to store string that have accented characters (à,ê, etc...)

I keep getting error 1396 "Cannot convert text from the source character set to the destination character set." from the UTF-8 to lv text primitive (or the LV text to UTF-8)

Doing this fails

 

Insert INTO Table(
Name)
VALUES(
'Musée National')
)

 

 But if I read a database file that contains "Musée National" it works

I've just noticed 2 VIs (not exposed in the palette), and think they might help, has anyone used that?

I'm not sure what is the impact of these 2 attributes but I'll poke around
TiTou_0-1750837723422.png

Any advise would be greatly appreciated

 


We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 1 of 4
(244 Views)

Do you know what Code Page your Linux System is set for?   The error suggests some kind of mixup in code pages.  If your Code Page is UTF-8, then you can use those two property nodes to tell the toolkit to assume all text is UTF-8 already, and skip using that function that errors.  

0 Kudos
Message 2 of 4
(189 Views)
Solution
Accepted by topic author TiTou

Yes on Ubuntu my code page is UTF-8
I'm unsure about Ubuntu & Debian Containers config, I will check.


I must admit I'm a bit confused with this issue, in the end what works for me on Windows (I rarely use this esoteric OS with LabVIEW), Linux, Linux container, whether I'm in source or compiled app is this :

TiTou_0-1750922972315.png

 


We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 3 of 4
(179 Views)

I think I got the answer (from a well know LLM), as indeed, I was only having issue when running my service in a container.

 

The issue you're experiencing is that Docker containers, including Ubuntu containers, start with minimal locale configurations by default. When you run echo $LANG in a Docker container, it often returns empty or shows "POSIX" because the locale environment variables aren't properly set during container initialization.
Why This Happens in Docker Containers

Docker containers are designed to be lightweight and minimal. The base Ubuntu images strip out many default configurations, including locale settings, to reduce image size
. Unlike a full Ubuntu installation where locale is configured during setup, Docker containers start with bare-bones locale configuration where LANG and other locale variables are either unset or set to "POSIX

 


We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 4 of 4
(175 Views)