TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
tony
NA
1
0
Converting iso-8859-1 to unicode
Jul 26 2006 11:35 AM
Hi I'm having a bit of difficulty with some text encoding, the problem is that i have set up all posts so that "ISO-8859-1" is used so that when a user adds the pound symbol "£" in a text area field then character is encoded to "£" and if the user includes "&" in the text area then the character is encoded to "&", this is nessasay so that users can use the "£" symbol. The problem is that text area field has a character length validatoin check on it and if the user includes the "£" or "&" characters in the text then the characters are counted as 5 and 4 characters respectiveley instead of 1. I have tried to convert the string from the text area from "ISO-8859-1" to unicode so that "£" is changed to "£" using the code below but this does not seem to work. String aString = jobDescriptionTextArea.Value; Encoding latinEuropeanEncoding = System.Text.Encoding.GetEncoding("iso-8859-1"); Encoding uniCode = Encoding.Unicode; byte[] latinBytes = latinEuropeanEncoding.GetBytes(aString); byte[] unicodeBytes = Encoding.Convert(latinEuropeanEncoding, uniCode, latinBytes); char[] unicodeCharArray = new char[uniCode.GetCharCount(unicodeBytes, 0, unicodeBytes.Length)]; uniCode.GetChars(unicodeBytes, 0, unicodeBytes.Length, unicodeCharArray, 0); String outputString = new String(unicodeCharArray); Response.Write("converted string >" + outputString + "<
"); Any suggestions? Cheers
Reply
Answers (
0
)
about authentication
datalist control