post unicode to website.

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
Jellobus
Posts: 317
Joined: Tue Dec 10, 2013 2:53 pm

post unicode to website.

Post by Jellobus » Wed Oct 19, 2016 7:55 am

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

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10099
Joined: Fri Feb 19, 2010 10:17 am

Re: post unicode to website.

Post by richmond62 » Wed Oct 19, 2016 9:54 am

I've never tried it; but how about using "set the htmlText"?

Jellobus
Posts: 317
Joined: Tue Dec 10, 2013 2:53 pm

Re: post unicode to website.

Post by Jellobus » Fri Oct 21, 2016 3:03 am

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?

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10099
Joined: Fri Feb 19, 2010 10:17 am

Re: post unicode to website.

Post by richmond62 » Fri Oct 21, 2016 7:06 pm

I thought I'd "fool about with this" a bit . . .
Ktext.png
Ktext.png (6.91 KiB) Viewed 5999 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 5999 times
Which looks like the text has been changed from double-byte chars into single-byte ones . . .

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10099
Joined: Fri Feb 19, 2010 10:17 am

Re: post unicode to website.

Post by richmond62 » Fri Oct 21, 2016 7:11 pm

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.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10099
Joined: Fri Feb 19, 2010 10:17 am

Re: post unicode to website.

Post by richmond62 » Fri Oct 21, 2016 7:19 pm

twit.png
As Livecode does everything in UTF-16 this is probably
where the problem lies.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10099
Joined: Fri Feb 19, 2010 10:17 am

Re: post unicode to website.

Post by richmond62 » Fri Oct 21, 2016 7:22 pm

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 5994 times
And a Very Happy Christmas to all our readers :)

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10099
Joined: Fri Feb 19, 2010 10:17 am

Re: post unicode to website.

Post by richmond62 » Sat Oct 22, 2016 2:20 pm

Here's the stack:
Unicode-to-Tweet7legacy.livecode.zip
(676 Bytes) Downloaded 206 times

Jellobus
Posts: 317
Joined: Tue Dec 10, 2013 2:53 pm

Re: post unicode to website.

Post by Jellobus » Sun Oct 23, 2016 8:55 am

richmond62> You rock! That's fantastic work! Thanks a million! :D

Post Reply