Read data in datagrid with æøå

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
tusa
Posts: 36
Joined: Sun Jan 31, 2016 10:30 pm

Read data in datagrid with æøå

Post by tusa » Wed Dec 21, 2016 2:05 am

Hello everybody.

I have a datagrid as you see here:
Udklip.JPG
Udklip.JPG (14.65 KiB) Viewed 4607 times
When I try to readout the data it will look like this instead:
Sren Laursen
Kbenhavn
Klaus Kj

How can I readout the right letters?

Best regards Tue.

Klaus
Posts: 14208
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Read data in datagrid with æøå

Post by Klaus » Wed Dec 21, 2016 3:52 pm

Dag Tue,

hm, just made a test with LC 8.1.2 on a german macOS 10.12.2 and it works as exspected!?
See attached screenshot.

What script are you using to read out the data?


Best

Klaus
datagrid_accent.jpg

tusa
Posts: 36
Joined: Sun Jan 31, 2016 10:30 pm

Re: Read data in datagrid with æøå

Post by tusa » Wed Dec 21, 2016 6:27 pm

Hello Klaus.

I've now testet it as you did.
Internally it works without any problems.
I'm writing a client for CasparCG and when I send the data to the CasparCG the problem appears.

Brg Tue.

Klaus
Posts: 14208
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Read data in datagrid with æøå

Post by Klaus » Wed Dec 21, 2016 6:38 pm

Dag Tue,

ah, so it looks like this is an textencoding problem!
What encoding is the "CasparCG" exspecting?

Also check the "textEncode" command in the dictionary!


Best

Klaus

tusa
Posts: 36
Joined: Sun Jan 31, 2016 10:30 pm

Re: Read data in datagrid with æøå

Post by tusa » Wed Dec 21, 2016 8:40 pm

Probably it has something to do with the encoding of the text.

When I use text stored in fields to send to CasparCG I do like this:

Code: Select all

put the unicodeText of field "Navn" into cgNavnUni
put the unicodeText of field "Kreds" into cgKredsUni
put the unicodeText of field "Navn_2" into cgNavn_2Uni
put uniDecode (cgNavnUni, "UTF8") into cgNavnUtf8
put uniDecode (cgKredsUni, "UTF8") into cgKredsUtf8
put uniDecode (cgNavn_2Uni, "UTF8") into cgNavn_2Utf8
put cgNavnUtf8 into cgF0
put cgKredsUtf8 into cgF1
put cgNavn_2Utf8 into cgF2
and then I send cgF0, cgF1 and cgF2 to CasparCG without problems.
When I use data stored in a datagrid I do like this:

Code: Select all

put the dgHilitedLines of group "seqGrid" into theLine
put the dgDataOfLine[theLine] of group "seqGrid" into theDataA
put theDataA["f0"] into tf0Line
put theDataA["f1"] into tf1Line
put theDataA["f2"] into tf2Line
and then I send tf0Line, tf1Line and tf2Line to CasparCG and then there is problems.

But how do I convert the text then?

Klaus
Posts: 14208
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Read data in datagrid with æøå

Post by Klaus » Wed Dec 21, 2016 8:50 pm

Hi Tue,

please note that most of the "unicode..." handlers, functions and properties are deprecated since version 7 in Livecode!
That means e.g. "unicodetext", "uniencode" and "unidecode"!
Use the "textencode/textdecode" functions instead.

Try this:
...
put the dgHilitedLines of group "seqGrid" into theLine
put the dgDataOfLine[theLine] of group "seqGrid" into theDataA
put textencode(theDataA["f0"],"UTF-8") into tf0Line
put textencode(theDataA["f1"],"UTF-8") into tf1Line
put textencode(theDataA["f2"],"UTF-8") into tf2Line
...
before sending the data to CasparCG.


Best

Klaus

tusa
Posts: 36
Joined: Sun Jan 31, 2016 10:30 pm

Re: Read data in datagrid with æøå

Post by tusa » Wed Dec 21, 2016 9:12 pm

Hello Klaus.

Indeed, that was just what I needed!
Thank you so much!

I will defanatly return with other questions.

Best regards Tue.

Post Reply