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: Klaus, FourthWorld, heatherlaine, kevinmiller

Post Reply
Jellobus
Posts: 319
Joined: Tue Dec 10, 2013 2:53 pm

post unicode to website.

Post 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
richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10431
Joined: Fri Feb 19, 2010 10:17 am

Re: post unicode to website.

Post by richmond62 »

I've never tried it; but how about using "set the htmlText"?
Jellobus
Posts: 319
Joined: Tue Dec 10, 2013 2:53 pm

Re: post unicode to website.

Post 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?
richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10431
Joined: Fri Feb 19, 2010 10:17 am

Re: post unicode to website.

Post by richmond62 »

I thought I'd "fool about with this" a bit . . .
Ktext.png
Ktext.png (6.91 KiB) Viewed 6743 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 6743 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: 10431
Joined: Fri Feb 19, 2010 10:17 am

Re: post unicode to website.

Post 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.
richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10431
Joined: Fri Feb 19, 2010 10:17 am

Re: post unicode to website.

Post by richmond62 »

twit.png
As Livecode does everything in UTF-16 this is probably
where the problem lies.
richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10431
Joined: Fri Feb 19, 2010 10:17 am

Re: post unicode to website.

Post 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 6738 times
And a Very Happy Christmas to all our readers :)
richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10431
Joined: Fri Feb 19, 2010 10:17 am

Re: post unicode to website.

Post by richmond62 »

Here's the stack:
Unicode-to-Tweet7legacy.livecode.zip
(676 Bytes) Downloaded 266 times
Jellobus
Posts: 319
Joined: Tue Dec 10, 2013 2:53 pm

Re: post unicode to website.

Post by Jellobus »

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