Problem with accented letters [SOLVED]

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
atout66
Posts: 266
Joined: Wed Feb 02, 2011 12:31 pm

Problem with accented letters [SOLVED]

Post by atout66 » Sat Apr 19, 2014 8:34 am

Hi to all,

I have a problem when I have accented letters in a custom propertie and I put them in a variable.
I lose the accentuations ...
For example in a custom propertie I store the word : "Références"
If I want to put this custom propertie into a var to deal with it later, the var store : "Références". But the custom property own "Références"!

So if I must compare "Références" with a other word, in fact I compare "Références" and that doesn't work for sure.

Not sure if I'm clear enought :wink:

Any idea ?

Kind regards, Jean-Paul.
Last edited by atout66 on Sat Apr 19, 2014 1:37 pm, edited 3 times in total.
Discovering LiveCode Community 6.5.2.

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: Problem with accented letters

Post by jmburnod » Sat Apr 19, 2014 9:40 am

Bonjour Jean-Paul,
I use customprop to store data with accented letters without problem.

I tested :

Code: Select all

on mouseUp
   set the uMyRef of this stack to "références"
   put the uMyRef of this stack 
end mouseUp
and the result is as expected "références

"Références" is strange for me yet, but I'm sure some users of this forum have an answer

Kind regards
Jean-Marc
https://alternatic.ch

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

Re: Problem with accented letters

Post by Klaus » Sat Apr 19, 2014 11:49 am

Bonjour mes amis,

this only happens when you enter the content into a custom property on a Mac and retrieve it on Windows (or vice versa).
That is because, unlike the content of fields, the content of custom properties will NOT be translated to the appropriate
platform text encoding.

In other words, this should not happen on the SAME platform!?
And works here, of course.

Anything else that might "interfere" in your stack somehow?


Best

Klaus

atout66
Posts: 266
Joined: Wed Feb 02, 2011 12:31 pm

Re: Problem with accented letters

Post by atout66 » Sat Apr 19, 2014 12:42 pm

Oups ! I'm confused... You're both right.
I've done the test like Jean-Marc suggested and it's exact. Also, I'm on the same plateforme.
I must have done something wrong with my variables, so I go back to the Code Editor and try to find where is my mistake.

Sorry for the inconvenience...

Kind regards, Jean-Paul.
Discovering LiveCode Community 6.5.2.

atout66
Posts: 266
Joined: Wed Feb 02, 2011 12:31 pm

Re: Problem with accented letters [SOLVED]

Post by atout66 » Sat Apr 19, 2014 1:15 pm

Well, the problem is solved because the question was not the right one!
In fact the question is:
How can I convert a var which contains "Références" to have it containing "Références".

For Jean-Marc, I understand it sounds strange this "Références", but it's because it's taken from the code source of an HTML page.
For myself, I was expected "R.C3.A9f.C3.A9rences" and not "Références" too, but it is so...

The miracle is that when I use

Code: Select all

set the unicodeText of fld "leTest" to uniEncode (leMot, "UTF8") 
it displays "Références" correctly for both "R.C3.A9f.C3.A9rences" and "Références" :shock:
Not sure to be clear enough as I'm myself a little lost with all that conversions requirements :wink:

Kind regards, Jean-Paul.
Discovering LiveCode Community 6.5.2.

atout66
Posts: 266
Joined: Wed Feb 02, 2011 12:31 pm

Re: Problem with accented letters

Post by atout66 » Sat Apr 19, 2014 1:37 pm

Hi to all,
To answer to myself, here is how I did to solve the problem.
I put the var with " "Références"" in a field with this code:

Code: Select all

set the unicodeText of fld "leTest" to uniEncode (leMot, "UTF8") 
This way the word "Références" is correct in the field, and then I load the text of the field into a var :!:
I know it's not so "pro" but for my needs, it's OK and I didn't find anything else :wink:

Thanks to all,
Jean-Paul.
Discovering LiveCode Community 6.5.2.

Post Reply