473,480 Members | 2,077 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

display problem of UTF-8 characters

Dormilich
8,658 Recognized Expert Moderator Expert
Hi,

I want to display some Unicode Entities (arond U+2650, some graphical symbols) but I can’t get them to display in the browser (tested FF, Safari)

what I have:
.html file (utf-8 encoded)
.js file (utf-8 encoded)

insert:
Expand|Select|Wrap|Line Numbers
  1. obj.symbol = "♜";
  2. // somewhere later in the code
  3. element.innerHTML = obj.symbol;
now what happens is that the symbol is converted into an Unicode char (I can text select one single char) and inserted into the HTML, but there is no visibility (besides that I can select it...).

ex. "♜"

strangely enough, if I select and copy-paste the text into my editor, I get the character as if nothing had happened. ah, yes, and of course the ACSII and ISO range values all work (e.g. 252).

if I use
Expand|Select|Wrap|Line Numbers
  1. obj.symbol = "&#9820";
  2. // somewhere later in the code
  3. element.innerHTML = obj.symbol;
I get displayed "♜" i.e. the symbol string is not converted at all.

there’s (possibly) one kind of solution, though. MDC has a String.fromCharCode() fix for UTF-16. it could work for multibytes as well (if you change the base values … which I don’t know).

can anyone help me fix that problem?

thanks
Oct 20 '09 #1
4 3193
gits
5,390 Recognized Expert Moderator Expert
just tested the following in 3.5.5pre on ubuntu ... which worked and displayed the symbol seamlessly:

Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. <script type="text/javascript">
  4. function setSymbol(val, nodeId) {
  5.     var node = document.getElementById(nodeId);
  6.     node.innerHTML = val;
  7. }
  8. </script>
  9. <body>
  10. <div id="foo"></div>
  11.  
  12. <input type="button" value="setSymbol" onclick="setSymbol('&#9820', 'foo')"/>
  13.  
  14. </body>
  15. </html>
  16.  
may be i didn't get the problem quite well?

kind regards
Oct 24 '09 #2
Dormilich
8,658 Recognized Expert Moderator Expert
didn’t work at first either, until I changed to some rather unusual font* (I already tried Georgia, Verdana, Tahoma, … with no luck)

* - MS Gothic
Oct 24 '09 #3
gits
5,390 Recognized Expert Moderator Expert
so with MS Gothic it worked?
Oct 24 '09 #4
Dormilich
8,658 Recognized Expert Moderator Expert
@gits
strange, but yes. seems that the “normal” webfonts do not have glyphs in that specific Unicode range.
Oct 24 '09 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

4
4546
by: Scott Vercuski | last post by:
Hello All, I'm having a problem saving/displaying multiple lanaguages on an ASP page. Here's the general problem I'm having. I have an admin area of a website that allows a user to enter items...
4
2388
by: Bill Todd | last post by:
Is there any way to display the RowState of each row in a computed column in the DataTable? -- Bill
3
3549
by: Tom | last post by:
Hi, I built a aspx web page which the charset is UTF-8. I need to present the same Chinese content to both Traditional and Simplified Chinese. However, it shows error code for UTF-8, Big 5 or...
9
2399
by: dennist685 | last post by:
Walkthrough: Creating a Web Page to Display Access Database Data I've started the above walkthrough. However, near the beginning it gives the following instructions To set permissions in the...
2
1803
by: David | last post by:
I am trying to get an image to appear on all Mondays within the calendar control. I also want that image to be a link. How can I do this?
4
6357
by: Mike L | last post by:
Error occurs on "System.Deployment.Application.ApplicationDeployment.CurrentDeployment" ** Here is my code private void frmMain_Load(object sender, System.EventArgs e) {...
4
3963
by: cathy | last post by:
Hi All, I am having problems displaying content relevant to the option selected in a drop-down menu. I have an xml document which is running content through Flash and I need to have the same...
1
2187
by: shapper | last post by:
Hello, I am trying to convert an Asp.Net XML sitemap file in a Google XMl sitemap file using a XSL file using an HttpHandler. Everything seems well in my code but I am getting an error: XML...
15
3126
by: cssExp | last post by:
hello, Rather than going on a wild explanation on what's the the problem, it'll be much quicker and easier if i let you look at it yourself, so I'll post my page source (actual contents taken out,...
3
2830
by: =?Utf-8?B?QmlsbHkgWmhhbmc=?= | last post by:
I have a asp.net app, in the page there is a scan activex which could scan and save a jpg file in client harddisk. How could we access and display this jpg file on the fly using js in the client...
0
7051
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7097
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6750
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5353
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4794
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4493
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3003
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1307
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
567
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.