Page 1 of 1

Solved: Getting crazy with "TÄubchen-Soße" ...

Posted: Mon Jun 13, 2016 5:13 pm
by AxWald
Hi,

it's time to cry for help - my brain feels like a hive of hornets, and my eyes are becoming more & more rectangular, but this must work - it should be so simple!

Problem: LC 6.7.10, Call a function with a HTML encoded string:

Code: Select all

put test("TÄubchen-Soße")
The function doesn't do anything:

Code: Select all

function test MyStr
   return MyStr
end test
Expected: The function works and returns the string.

Result: Nothing happens. :? Only the message watcher shows:

Code: Select all

    test("T&Auml 5:58:03 PM (1984)
So the semicolon is the culprit. So far, so good. Tried with & without quotes, parentheses, URLen/decode, nothing works.

What's to do? Do I really need to charToNum the whole string before, just to pass it to a function? There must be a simpler way, and I'm sure I'll bang my head upon the table once you've told me ...

Thx for your help, have fun!

Edit: See here for the solution!

Re: Getting crazy with "TÄubchen-Soße" ...

Posted: Mon Jun 13, 2016 5:50 pm
by Klaus
Hi AxWald,

just tested your script(s) with LC 8.01 and it works as exspected, I get this in the message box: TÄubchen-Soße
Täubchen-Soße? :shock: :D

What version are you using?


Best

Klaus

Re: Getting crazy with "TÄubchen-Soße" ...

Posted: Mon Jun 13, 2016 9:47 pm
by AxWald
Hi,
Klaus wrote:What version are you using?
Win 10-64: LC 6.7.10 & LC 8.0
Win Server 2003 R2: LC 6.7.1
Lubuntu 16.04-64: LC 6.7.10

All the same.
Sometimes there's a blink of an error message, and I find an "e" in the Message box - probably the last char. See yourself:
täubchen.png
Ich wollt' doch nur die Täubchen-Soße ...
Gonna get me some sleep now, maybe tomorrow the world looks brighter ...

Have fun!

Fun fact: Copying & inserting the code example from my post above (in Firefox), to the LC 8.0 msg box:

Code: Select all

Version:0.9 StartHTML:00000161 EndHTML:00000288 StartFragment:00000195 EndFragment:00000252 SourceURL:http://forums.livecode.com/viewtopic.php?f=9&t=27486 put test("TÄubchen-Soße")
Only LC 8 does this, no other program ...

Re: Getting crazy with "TÄubchen-Soße" ...

Posted: Tue Jun 14, 2016 5:20 pm
by AxWald
Hi,

did further tests. 8.1 dp1 works, 6.5.1 up to 8.0 stable doesn't. So there must have been a change in 8.0.1.

It's the semicolon, deftly. And only if used as parameter to an own function - "put lower("TÄubchen-Soße") for instance works flawlessly.

Not to be able to pass such data as parameters is a bummer - actually a showstopper in a current project where I have to work with data containing HTML entities. There's bazillions of those to compute in different ways ...

I'm still sure a most obvious solution escapes me!

Have fun!

Re: Getting crazy with "TÄubchen-Soße" ...

Posted: Wed Jun 15, 2016 3:41 pm
by jacque
The easiest solution is to use the version of LC that works. But you could also try this:

Code: Select all

set the htmltext of the templateField to tStr
put the text of the templateField into tStr
If you're using LC 7 or higher that should convert it to regular text.

Re: Getting crazy with "TÄubchen-Soße" ...

Posted: Sat Jun 18, 2016 4:43 pm
by AxWald
Hi,

case solved. If I call my:

Code: Select all

put test("TÄubchen-Soße")
from the msgbox, any LC < 8.01 gives me the finger.

Now if I call it from a button, all of a sudden it gives me the desired delicious "T&Auml;ubchen-So&szlig;e"!
Now I can happily shove it to my HTML_entity converter, get the correct "Täubchen-Soße" *1 - just the "Täubchen" *2 is already eaten, for long ...

Notice to myself: Never trust the Message Box!

Have fun!

*2. "Täubchen" = squab, pigeon
*1. "Täubchen-Soße" = sauce made from, eaten to above