encoding issue in ssrs report
hi , i have an issue with ssrs reports 2005 with some japanese characters not displaying properly,
i have a text "14æ³ ãƒ•ãƒ©ãƒ³ã‚¹ç•™å¦" which is being pulled from database and i need to convert this text to unicode(utf-8) format.
i tried the following code to do that
codePageEncoding = System.Text.Encoding.GetEncoding(codePage)
codePageBytes = System.Text.Encoding.[Default].GetBytes(codePageValue)
unicodeBytes = System.Text.Encoding.Convert(codePageEncoding, System.Text.Encoding.Unicode, codePageBytes)
unicodeValue = System.Text.Encoding.Unicode.GetString(unicodeBytes)
Return System.Web.HttpUtility.HtmlDecode(unicodeValue)
with codepage 936 for japan. i am supposed to get the output as 14 which is not coming... i tried different options but could not proceed.
i used code option in layout properties of the report for coding..
Can someone help me on this ..
Regards
Achuth
June 30th, 2011 5:55am
i got the solution for this issue... i fixed the issue by decoding the text
Public Shared Function ConvertToUnicode(ByVal codePageValue As String) As String
Dim encoder As New System.Text.UTF8Encoding()
Dim utf8Decode As System.Text.Decoder = encoder.GetDecoder()
Dim todecode_byte As Byte() = System.Text.Encoding.[Default].GetBytes(codePageValue)
Dim charCount As Integer = utf8Decode.GetCharCount(todecode_byte, 0, todecode_byte.Length)
Dim decoded_char As Char() = New Char(charCount - 1) {}
utf8Decode.GetChars(todecode_byte, 0, todecode_byte.Length, decoded_char, 0)
Dim result As String = New [String](decoded_char)
return result
End Function
which solved the issue , now i am getting proper text.
Free Windows Admin Tool Kit Click here and download it now
July 1st, 2011 7:01am


