problem with IExplore and unicode control chars

G

Guest

Hi everybody,

I've got a web application where I need to join several strings, some of
which are read from a dbase and display then IN the order they are joined.
I.E. I want to display "Hello {USERNAME}, How are you doing?" ({USERNAME} is
read from dbase).
Now the problem is that the strings around the {USERNAME} should be in hebrew,
and the USERNAME can be either hebrew or english or mixed.
Because of the BIDI algorithm if the string contains hebrew and english
chars it might not display as required.
I've tried various methods to solve this and eventually I found a method
that works
by inserting Unicode control chars between the joined strings (LRE & PDF,and
Zero-Width-Space).
The resulting strings look right in windows applications but when I try to
use them in a web page there is an extra space.
Apparently IExplore show the Zero-Width-Space as a normal space.

Does anybody know how to make IExplore not show the zero-width-space?
Or another way to make sure the joined strings are displayed correctly
regardless of the direction of the chars in the strings.

Thanks
Nadav

PS. I put the zero-width-space because I found (by experimenting) that for
some reason if you put a LRE code right after a PDF code it does NOT work.
So I add a zero-width-space between them.
 
S

Steven Cheng[MSFT]

Hi Nadav,

Thank you for posting.

Regarding on the Unicode BIDI text displaying issue in IE, since you
mentioned that it can be displayed correctly in winform application and has
some slight difference when displayed in web page, I think it is possibly
due to the different presenation mechanism of html web page. For web page,
the content is HTML which is parsed and displayed in clent-side webbrowser.
And html text doesn't care about normal linefeed or space in normal
text(like \r\n ...), in webpage if we want to explicitly display or insert
spaces in html text, we should use some certain html tag or entity, e.g:
the space in HTML should be replaced by " " , while linefeed should be
replaced by <br/> element. Also ,for unicode bidi text, html support
configure text's bidi attribute through the "dir" attribute, however, I
think you may need to separate text with differernt display order into
different html fragment. Here are some web article describes the HTML text
direction(BIDI) support:


http://www.weizmann.ac.il/IU/create/danon_excerpt.html

http://ppewww.ph.gla.ac.uk/~flavell/charset/text-direction.html

Hope this helps.

Regards,

Steven Cheng
Microsoft Online Community Support


==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================


This posting is provided "AS IS" with no warranties, and confers no rights.



Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
G

Guest

Thanks, Steven

The links you supplied were just what I needed to fix the problem.
(I've been having a lot of problems finding documentation on Unicode control
chars usage).

I've fixed the problem by changing to use ZERO-WIDTH-NON-JOINER which IE
does NOT display instead of ZERO WIDTH SPACE which IE shows as normal width.

The links recommend using html tags instead of unicode control chars.
I tried it and it does work...
You can use <span dir=ltr>..</span> instead of {LRE}..{PDF} to achieve the
'visual join' that I wanted.

I just don't like the idea of inserting HTML tags inside my text.
One of the main reasons we decided to you ASP.NET was that it was supposed
to automatically generate the right markup depending on the browser.
(Our web application also runs on cellular phones)

Any I'll have to decide if I change my code to insert the html tags or
continue using the unicode codes.

Anyway, Thanks for your help

Nadav
 
S

Steven Cheng[MSFT]

Thank you for the response Nadav,

Glad that the suggestion is of assistance. Also, regarding on the further
concern you mentioned:

====================
I just don't like the idea of inserting HTML tags inside my text.
One of the main reasons we decided to you ASP.NET was that it was supposed
to automatically generate the right markup depending on the browser.
(Our web application also runs on cellular phones)
====================

Yes, I agree and completely understand your consideration since we'd better
not include presentation specific code or mark in our data text. I think
you can consider developing a custom webserver control for such scenario,
it'll parse the text bound to it and then, replace all the unicode control
chars with the html unicode tags (<span dir=....>).

Hope this also helps.

Regards,

Steven Cheng
Microsoft Online Community Support


==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================


This posting is provided "AS IS" with no warranties, and confers no rights.
 
G

Guest

Steven Cheng said:
Yes, I agree and completely understand your consideration since we'd better
not include presentation specific code or mark in our data text. I think
you can consider developing a custom webserver control for such scenario,
it'll parse the text bound to it and then, replace all the unicode control
chars with the html unicode tags (<span dir=....>).

Hope this also helps.
That's an interesting Idea.
I'll see if I can implement something like this...

Thanks,

Nadav
 
S

Steven Cheng[MSFT]

You're welcome Nadav,

Good luck!

Regards,

Steven Cheng
Microsoft Online Community Support


==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================


This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,817
Latest member
DicWeils

Latest Threads

Top