|
![]() |
|
| Author |
|
|||||||
|
mooby
Posts: 3694
Location: UK
|
anyone had experience with html enties?
i need to know how to convert utf-8 chars (chinese) to html enties like 节 |
|||||||
| #0 02:08am 29/11/07 |
|
|||||||
|
system
|
--
|
|||||||
| #0 |
|
|||||||
|
Jim
Posts: 6886
Location: Brisbane, Queensland
|
||||||||
| #1 06:45am 29/11/07 |
|
|||||||
|
mooby
Posts: 3696
Location: UK
|
thanks, found a great php article... just need a dot net framework one :S
|
|||||||
| #2 07:32am 29/11/07 |
|
|||||||
|
Jim
Posts: 6887
Location: Brisbane, Queensland
|
don't have a language reference like the php manual?
|
|||||||
| #3 08:23am 29/11/07 |
|
|||||||
|
Persay
Posts: 4681
Location: Other International
|
jim making serious posts is sooooooo confusing, you're supposed to just say things about 4wd and post "no u" whenever there's a serious debate going on
|
|||||||
| #4 11:12am 29/11/07 |
|
|||||||
|
Jim
Posts: 6889
Location: Brisbane, Queensland
|
serious, like your momma lol
|
|||||||
| #5 01:53pm 29/11/07 |
|
|||||||
|
Opec
Posts: 4821
Location: Brisbane, Queensland
|
||||||||
| #6 02:26pm 29/11/07 |
|
|||||||
|
Jim
Posts: 6890
Location: Brisbane, Queensland
|
ahah that's php too
|
|||||||
| #7 02:37pm 29/11/07 |
|
|||||||
|
Opec
Posts: 4822
Location: Brisbane, Queensland
|
LOL
|
|||||||
| #8 02:44pm 29/11/07 |
|
|||||||
|
mooby
Posts: 3698
Location: UK
|
thanks guys, what a nightmare, still not solved. has to be done by monday :S
http://www.w3.org/TR/REC-html40/charset.html#encodings and http://www.unicode.org/unicode/faq/unicode_iso.html That lists the entities as ISO10646. Theres good articles on changing encodings, http://msdn2.microsoft.com/en-us/library/system.text.encoding.getencodings.aspx but dont seem to do to ISO10646 :S |
|||||||
| #9 08:13pm 29/11/07 |
|
|||||||
|
hast
Posts: 861
Location: Brisbane, Queensland
|
just convert the string to utf32 (System.Text.Encoding.UTF32) iterate over the bytes in groups of 4 and convert them back to an int and do &#number; for each int
i think that is the bullet proof way to do it. you could also try and use Char.ConvertToUtf32 but there is some weirdness with surrogate pairs which will probably screw up asian languages. |
|||||||
| #10 10:23pm 29/11/07 |
|
|||||||
|
mooby
Posts: 3700
Location: UK
|
thanks hast! day too late tho, found an article that just exactly what you said. : )
|
|||||||
| #11 03:57am 30/11/07 |
|
|||||||
|
Jim
Posts: 6892
Location: Brisbane, Queensland
|
share
|
|||||||
| #12 08:30am 30/11/07 |
|
|||||||
|
mooby
Posts: 3701
Location: UK
|
||||||||
| #13 08:12pm 30/11/07 |
|
|||||||
|
system
|
--
|
|||||||
| #13 |
|
|||||||
|
| ||||||||