2011-06-07 54 views
0

我通過這個字符串的報告:Economia e AdministraçãoSSRS如何外語字符解碼

但該報告顯示以下內容:Economia e Administração

在URL其編碼爲: Economia%20e%20Administra%C3%83%C2%83%C3%82%C2%A7%C3%83%C2%83%C3%82%C2%A3o%20

我嘗試使用URLDecode,但它不起作用。

任何想法?

謝謝!

回答

0

這裏是我的解決方案......在母公司報表中的字符串轉換爲字節數組字符串,並傳遞給孩子報:

Function GetStringBytes(ByVal theString As String) As String 
    Dim bytes() As Byte = System.Text.Encoding.UTF8.GetBytes(theString, 0, theString.Length) 
    Dim builder As New System.Text.StringBuilder 
    For Each i As Integer In bytes 
     builder.Append(i & "|") 
    Next i 
     Return builder.ToString().TrimEnd("|") 
    End Function 

在子報告的字節數組字符串傳遞給下面的GetString函數將其轉換回原始字符串:

Function GetString(ByVal theBytes As String) As String 
    Dim byts() As Byte = New Byte(theBytes.Split("|").Length) {} 
    Dim count As Integer = 0 
    For Each i As String In theBytes.Split("|") 
     byts(count) = Convert.ToInt32(i) 
     count += 1 
    Next i 
    Return UTF8ByteArrayToString(byts) 
End Function 

Function UTF8ByteArrayToString(ByVal theChars As Byte()) As String 
    Dim aEncoding As System.Text.UTF8Encoding = New System.Text.UTF8Encoding() 
    Dim aConstructedString As String = aEncoding.GetString(theChars) 
    Return aConstructedString 
End Function 

適合我的作品。

0

它看起來像它被轉換成UTF-8兩次,即編碼的字符串正在被再次編碼。原始字符串是以Unicode還是UTF-8或其他方式傳遞的?

更正:它被轉換成UTF-8三次!

+0

感謝您的回覆!原始字符串由父報告傳遞,我不知道SSRS用於傳遞字符串的方法,我只知道它傳遞給URL。 – user259286 2011-06-07 18:30:38