Page 1 of 1

post unicode to website.

Posted: Wed Oct 19, 2016 7:55 am
by Jellobus
Hi all :)

How can the unicode text be posted on the website such as Twitter? alphabets can be posted as I expected but I had no luck with Korean or Japanese text. I am using LC 7 and my code is here,

Code: Select all

on mouseUp
   put field "koreanText" into pBody
   launch url "http://www.twitter.com/intent/tweet?text=" & urlEncode(pBody)
end mouseUp
Any good suggestions will be very appreciated.

Thanks for your time!

Louis

Re: post unicode to website.

Posted: Wed Oct 19, 2016 9:54 am
by richmond62
I've never tried it; but how about using "set the htmlText"?

Re: post unicode to website.

Posted: Fri Oct 21, 2016 3:03 am
by Jellobus
set the htmltext is not working.. I tried with

Code: Select all

put unicode field "koreanText" into pBody
launch url "http://www.twitter.com/intent/tweet?text=" & urlEncode(pBody)
but the result still shows "??????" on the webpage. is there any possible way to post foreign languages via the url launch command?

Re: post unicode to website.

Posted: Fri Oct 21, 2016 7:06 pm
by richmond62
I thought I'd "fool about with this" a bit . . .
Ktext.png
Ktext.png (6.91 KiB) Viewed 5996 times
This is my stack containing some false Korean text (i.e. a series of random Korean characters).

I just had a go with this:

Code: Select all

on mouseUp
   put the unicodeText of field "koreanText" into pBody
launch url "http://www.twitter.com/intent/tweet?text=" & urlEncode(pBody)
end mouseUp
And got this:
Ktext2.png
Ktext2.png (5.33 KiB) Viewed 5996 times
Which looks like the text has been changed from double-byte chars into single-byte ones . . .

Re: post unicode to website.

Posted: Fri Oct 21, 2016 7:11 pm
by richmond62
Oddly enough this:

Code: Select all

on mouseUp
   put the unicodeText of field "koreanText" into pBody
launch url "http://www.twitter.com/intent/tweet?text=" & pBody
end mouseUp
Produces just the same result, so, in this situation the "urlEncode" is redundant.

Re: post unicode to website.

Posted: Fri Oct 21, 2016 7:19 pm
by richmond62
twit.png
As Livecode does everything in UTF-16 this is probably
where the problem lies.

Re: post unicode to website.

Posted: Fri Oct 21, 2016 7:22 pm
by richmond62

Code: Select all

on mouseUp
put textEncode(field "koreanText","UTF-8") into pBody
launch url "http://www.twitter.com/intent/tweet?text=" & pBody
end mouseUp
Produces this:
Ktext4.png
Ktext4.png (4.86 KiB) Viewed 5991 times
And a Very Happy Christmas to all our readers :)

Re: post unicode to website.

Posted: Sat Oct 22, 2016 2:20 pm
by richmond62
Here's the stack:
Unicode-to-Tweet7legacy.livecode.zip
(676 Bytes) Downloaded 206 times

Re: post unicode to website.

Posted: Sun Oct 23, 2016 8:55 am
by Jellobus
richmond62> You rock! That's fantastic work! Thanks a million! :D