revBrowser on Mac: bad display of Unicode chars

Deploying to Mac OS? Ask Mac OS specific questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
sp27
Posts: 135
Joined: Mon May 09, 2011 3:01 pm

revBrowser on Mac: bad display of Unicode chars

Post by sp27 » Sun Jul 31, 2011 5:30 pm

Short version: revBrowser does not display Unicode characters in Mac OS X (PPC/Tiger and Intel/Snow Leopard). LC 4.6.2 and 4.6.3.

Long version:

I finished writing and testing my Russian dictionary application in Windows and started testing it in Mac OS X. My first surprise is that revBrowser does not display Cyrillic (Unicode) characters--neither on a PPC (Tiger) nor on an Intel (Snow Leopard) machine. The English portion is rendered fine, including styles and everything, but Cyrillic is rendered as if every double-byte character is interpreted as a sequence of two single bytes.

The source (the HTML text that is assigned to revBrowser as its htmltext property) comes from a local html file or from a database record. The result is the same. When the same text is assigned to the unicodeText property of a field, everything looks fine.

The usual character set meta tag in the html is present and indicates UTF-8. Works fine in Windows. Is there something about displaying UTF-8 in revBrowser in Mac OS X that I need to know? The browser that is used by LC is probably part of the Mac setup, right? All browsers on those two Macs display the same Web page fine.

I'll be grateful for any solution. I hope it's something I'm doing wrong--or not doing.

Thanks,

Slava

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4003
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: revBrowser on Mac: bad display of Unicode chars

Post by bn » Sun Jul 31, 2011 10:57 pm

Hi Slava,

I tried with a download of a russian wikipedia page downloaded as html source code localy and displayed it in the revBrowser example with LC 4.6.3 on MacOSX 10.6.8. All the russian characters showed up. Could you post a zipped sample of your html-file that does work on Windows and not on a Mac?

Kind regards

Bernd

sp27
Posts: 135
Joined: Mon May 09, 2011 3:01 pm

Re: revBrowser on Mac: bad display of Unicode chars

Post by sp27 » Mon Aug 01, 2011 4:43 am

Hi Bernd!

Many thanks for thinking and testing.

I attach a zip archive (made in Windows) that has a very small and simple stack and an HTML file. Nothing else is required. When run in Windows 7, all buttons work, everything is beautiful. When run on my Mac G5 10.5.8 or MacBook 10.6.8, these problems are immediately visible:

1) Cyrillic letters are not displayed correctly (Russian text is unreadable).

2) RevBrowserCallScript() returns error "WebUndefined cStringUsingEncoding: unrecognized selector sent to instance."

I very much hope these problems are caused by something I am doing wrong.

sp27 (Slava)
Attachments
RussianInRevBrowser.zip
(7.39 KiB) Downloaded 327 times

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4003
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: revBrowser on Mac: bad display of Unicode chars

Post by bn » Mon Aug 01, 2011 9:16 am

Hi Slava,

I dont get your script to work, something is wrong when converting from the unicodeText of the field to UTF8. As you know I am not much into unicode, more into cheating...

If you access the file directly to display in revBrowser then it shows up correctly:

Code: Select all

 revBrowserSet gBrowserID, "URL", locHTMLFilePathName
This may or may not be a solution for you.

As for the javascript error, again I don't know a thing about javascript but what I find funny is that although I get the error you describe when changing font size, the font size actually changes.
If you put the line of code into a try-end try it works, again no explanation, just an ugly hack

Code: Select all

   try
      get revBrowserCallScript(gBrowserID, "SetFontSize", gFontSize & "px")
   end try
Sorry to be of no more of a help, maybe someone with more knowledge of unicode and javascript is able to shed some light on these issues.

All this tested on a MacBookPro 2010 (Intel), MacOSX 10.6.8, LIvecode 4.6.3

Kind regards

Bernd

sp27
Posts: 135
Joined: Mon May 09, 2011 3:01 pm

Re: revBrowser on Mac: bad display of Unicode chars

Post by sp27 » Mon Aug 01, 2011 1:35 pm

Thanks for working on this, Bernd. I'm now going to post the issue on the dev list. Perhaps someone there has an idea.

Be well,

S.

Post Reply

Return to “Mac OS”