473,545 Members | 2,095 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

numeric entity to string and ie

ja
hi,

i have problems with converting entities to chars, i'm using function:

function entityToString (htmlString){

htmlString = htmlString.repl ace(/(&)(#)(\d{1,})( ;)/g, function
(tot,amp,cr,cp, sem) {
return String.fromChar Code(cp);
})

return(htmlStri ng);

}

and this works fine in all browsers (ff, opera, safari, konqueror) but not
in ie :(
it seems bo work with all european and math chars, but if it gets some like
this &#477 wich is upside down "e"

also if i select generated text (from ff) and do copy and paste into notepad
i get the same results as in ie...

it makes no different if i use innerHTML, createTextNode or allert...

any suggestion?

wojtek

Dec 2 '06 #1
10 1779
On Dec 2, 11:24 am, "ja" <j...@ja.jawrot e:
hi,

i have problems with converting entities to chars, i'm using function:

function entityToString (htmlString){

htmlString = htmlString.repl ace(/(&)(#)(\d{1,})( ;)/g, function
(tot,amp,cr,cp, sem) {
return String.fromChar Code(cp);
})

return(htmlStri ng);

}and this works fine in all browsers (ff, opera, safari, konqueror) but not
in ie :(
it seems bo work with all european and math chars, but if it gets some like
this &#477 wich is upside down "e"

also if i select generated text (from ff) and do copy and paste into notepad
i get the same results as in ie...

it makes no different if i use innerHTML, createTextNode or allert...

any suggestion?

wojtek
What sort of problem do you encounter?
The problem I have in IE (for linux...), is that I get a square instead
of the character. Is it what you get?

Dec 2 '06 #2
ja wrote on 02 dec 2006 in comp.lang.javas cript:
hi,

i have problems with converting entities to chars, i'm using function:

function entityToString (htmlString){

htmlString = htmlString.repl ace(/(&)(#)(\d{1,})( ;)/g, function
(tot,amp,cr,cp, sem) {
return String.fromChar Code(cp);
})

return(htmlStri ng);

}

and this works fine in all browsers (ff, opera, safari, konqueror) but
not in ie :(
it seems bo work with all european and math chars, but if it gets some
like this &#477 wich is upside down "e"

also if i select generated text (from ff) and do copy and paste into
notepad i get the same results as in ie...

it makes no different if i use innerHTML, createTextNode or allert...

This works fine here:

alert (entityToString ('Hello world: ABC ǝ') )

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

Why not simplify the regex and the whole function?

function entityToString2 (htmlString){
return htmlString.repl ace(/\&\#(\d+);/g,
function(y,x) {return String.fromChar Code(x);})
}

alert (entityToString 2('Hello world: ABC ǝ') )


--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Dec 2 '06 #3
ja
>
What sort of problem do you encounter?
The problem I have in IE (for linux...), is that I get a square instead
of the character. Is it what you get?
yeah this is it
Dec 2 '06 #4
ja
>
alert (entityToString 2('Hello world: ABC ǝ') )
is it works for you, in IE?

thanks for simplify :)

wojtek
Dec 2 '06 #5
ja wrote on 02 dec 2006 in comp.lang.javas cript:
>>
What sort of problem do you encounter?
The problem I have in IE (for linux...), is that I get a square instead
of the character. Is it what you get?

yeah this is it
Try another font!
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Dec 2 '06 #6
ja
Try another font!
>
but how can i change font in alert?
i've tried to change font, no differences for me?
did it work for you in IE with some font, which one?

wojtek
Dec 3 '06 #7
ja wrote on 03 dec 2006 in comp.lang.javas cript:
>Try another font!

but how can i change font in alert?
i've tried to change font, no differences for me?
did it work for you in IE with some font, which one?
If your system uses a font that does not have a particular character you
can try to use another font and us an html incsert in the debugging fase.

<div id='t'></div>

<script type='text/javascript'>
t = "string with such character"
document.getEle mentById('t'),i nnerHTML = t
</script>

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

When the above shows you it is a font problem, you can try to change the
font depending on your system [linux, etc], the how being off topic hee.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Dec 3 '06 #8
ja
no, it's no a font problem... i've manually add corrupt char to function:

function entenityToStrin g (htmlString){
return htmlString.repl ace(/\&\#(\d+);/g,
function(y,x) {
/*fix for ie*/
if(x=447){
return '?';
}
return String.fromChar Code(x);
})
}

and now it's working...

wojtek
Dec 3 '06 #9
ja
return '?';
of course '?' is right character
wojtek
Dec 3 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
23270
by: Randell D. | last post by:
Folks, I have a box that expects numeric input - I'd like to test for it (yeah, I'll have service side checks too but also want client checks). How can I test that my input is numeric - and numeric could mean positive or negative floating numbers For example: return true for 1, 1.5, -1, -4.25 and return false for any other non-numeric...
7
4859
by: Raj | last post by:
Hi I was hoping someone could suggest a simple way of stripping non-numeric data from a string of numbers. For example, if I have "ADB12458789\n" I would like to remove the letters and the newline from this string. I am new to C so am sure this is simple ut I don't know how to do it! Sorry!
54
6242
by: Victor Mehta | last post by:
would it matter if I decided to make a primary key a string of numbers vs actual numbers ? would it make any difference to DB2 in terms of efficiency ? why would you choose numeric over a string for a key that does not need to be in numeric format ? thanks -- reply to newsgroupsurferATyahooDOTcom
0
2806
by: Frederico Guimar??es via DotNetMonster.com | last post by:
Hi, I'm trying to use the Microsoft.Web.Services2.Messaging. ISoapFormatter but I receive this error: System.Xml.XmlException: Reference to undeclared parameter entity, 'meetingmaker'. at System.Xml.XmlLoader.ExpandEntityReference(XmlEntityReference eref) at System.Xml.XmlEntityReference.SetParent(XmlNode node) at...
0
2657
by: Andy B | last post by:
I wanted to try out the ado.net entity framework model and see how it was different from linq to sql entities. I put a page in a web application project, added an ado.net entity model and told it to generate the model from existing database, went back to my empty page and put a GridView on it. I right clicked on the GridView and went to show...
0
7396
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7656
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7805
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7751
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5323
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4943
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3449
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3440
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1874
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 we have to send another system

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.