sirjo66 Well-Known Member Licensed User Longtime User Aug 12, 2013 #1 Hello all I have a program that is an HttpServer and I have this code: Code: Copy Sub Server_HandleRequest (Request As ServletRequest, Response As ServletResponse) Log("Text: " & Request.GetParameter("testo")) If the customer call mypage with: http://192.168.0.xxx:5555/mypage?testo=hello world it works very well !! also it works with http://192.168.0.xxx:5555/mypage?testo=hello world è ! but with this command: http://192.168.0.xxx:5555/mypage?testo=hello%20world%20%E8%20%21 don't works %E8 is the char-code of char "è" (on ISO-8859-1) and I don't know how to manage it On log it appeare: Text: hello world ?! I have also try to change ISO-8859-1 in utf-8: Code: Copy Dim var As String = Request.GetParameter("testo") Dim arrByte() As Byte arrByte = var.GetBytes("ISO-8859-1") Dim result As String = BytesToString(arrByte, 0, arrByte.Length, "UTF8") Log("UTF8: " & result) but the result is the same: Text: hello world ?! UTF8: hello world ?! Help me please Sergio
Hello all I have a program that is an HttpServer and I have this code: Code: Copy Sub Server_HandleRequest (Request As ServletRequest, Response As ServletResponse) Log("Text: " & Request.GetParameter("testo")) If the customer call mypage with: http://192.168.0.xxx:5555/mypage?testo=hello world it works very well !! also it works with http://192.168.0.xxx:5555/mypage?testo=hello world è ! but with this command: http://192.168.0.xxx:5555/mypage?testo=hello%20world%20%E8%20%21 don't works %E8 is the char-code of char "è" (on ISO-8859-1) and I don't know how to manage it On log it appeare: Text: hello world ?! I have also try to change ISO-8859-1 in utf-8: Code: Copy Dim var As String = Request.GetParameter("testo") Dim arrByte() As Byte arrByte = var.GetBytes("ISO-8859-1") Dim result As String = BytesToString(arrByte, 0, arrByte.Length, "UTF8") Log("UTF8: " & result) but the result is the same: Text: hello world ?! UTF8: hello world ?! Help me please Sergio
Erel B4X founder Staff member Licensed User Longtime User Aug 13, 2013 #2 Try to URLDecode the parameter value with StringUtils. Upvote 0
sirjo66 Well-Known Member Licensed User Longtime User Aug 13, 2013 #3 SOLVED !! For the text "hello world è !" the correct encode is: Code: Copy http://192.168.0.xxx:5555/mypage?testo=hello%20world%20%C3%A8%20%21 because %E8 is ISO8859-1, but url works with utf8, and %C3%A8 is the correct code for "è" char Thanks ! Sergio Upvote 0
SOLVED !! For the text "hello world è !" the correct encode is: Code: Copy http://192.168.0.xxx:5555/mypage?testo=hello%20world%20%C3%A8%20%21 because %E8 is ISO8859-1, but url works with utf8, and %C3%A8 is the correct code for "è" char Thanks ! Sergio
Erel B4X founder Staff member Licensed User Longtime User Aug 14, 2013 #4 You can specify the encoding in StringUtils.EncodeUrl. Upvote 0