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

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

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
AxWald
Posts: 578
Joined: Thu Mar 06, 2014 2:57 pm

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

Post by AxWald » Mon Jun 13, 2016 5:13 pm

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!
Last edited by AxWald on Sat Jun 18, 2016 4:46 pm, edited 1 time in total.
All code published by me here was created with Community Editions of LC (thus is GPLv3).
If you use it in closed source projects, or for the Apple AppStore, or with XCode
you'll violate some license terms - read your relevant EULAs & Licenses!

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

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

Post by Klaus » Mon Jun 13, 2016 5:50 pm

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

AxWald
Posts: 578
Joined: Thu Mar 06, 2014 2:57 pm

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

Post by AxWald » Mon Jun 13, 2016 9:47 pm

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 ...
All code published by me here was created with Community Editions of LC (thus is GPLv3).
If you use it in closed source projects, or for the Apple AppStore, or with XCode
you'll violate some license terms - read your relevant EULAs & Licenses!

AxWald
Posts: 578
Joined: Thu Mar 06, 2014 2:57 pm

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

Post by AxWald » Tue Jun 14, 2016 5:20 pm

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!
All code published by me here was created with Community Editions of LC (thus is GPLv3).
If you use it in closed source projects, or for the Apple AppStore, or with XCode
you'll violate some license terms - read your relevant EULAs & Licenses!

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7393
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

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

Post by jacque » Wed Jun 15, 2016 3:41 pm

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.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

AxWald
Posts: 578
Joined: Thu Mar 06, 2014 2:57 pm

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

Post by AxWald » Sat Jun 18, 2016 4:43 pm

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
All code published by me here was created with Community Editions of LC (thus is GPLv3).
If you use it in closed source projects, or for the Apple AppStore, or with XCode
you'll violate some license terms - read your relevant EULAs & Licenses!

Post Reply