0

I have JSON string I got using from POST request.

I'm getting the post using this code:

bytecount = Request.TotalBytes
bytes = Request.BinaryRead(bytecount)

Set stream = Server.CreateObject("ADODB.Stream")
    stream.Type = 1 'adTypeBinary              
    stream.Open()                                   
        stream.Write(bytes)
        stream.Position = 0                             
        stream.Type = 2 'adTypeText                
        stream.Charset = "utf-8"                      
        s = stream.ReadText() 'here is your json as a string                
    stream.Close()
Set stream = nothing

Response.write(s)

The string look like this : "\u05e8\u05d5\u05e2\u05d9 \u05de\u05d6\u05e8\u05d7\u05d9" (It is in Hebrew)

How can I convert it and see it as Hebrew ? I'm not trying to view the page, I'm trying to insert it to database.

user2396640
  • 359
  • 4
  • 24
  • Can you show the request that produced this output? – user692942 Jun 24 '21 at 20:30
  • Try adding this at the top: Perhaps it is there already, but if this doesn't work, try UTF-16 instead. But I think the first answer is the correct one. – easleyfixed Jun 24 '21 at 21:56
  • @user692942 added. – user2396640 Jun 25 '21 at 05:08
  • @easleyfixed I'm not trying to view the page, I'm trying to insert it to database. – user2396640 Jun 25 '21 at 05:08
  • Feels like [this answer](https://stackoverflow.com/a/4908960/692942) is relevant. – user692942 Jun 25 '21 at 07:06
  • Quick question, why are you trying to convert to UTF-16? Seems you are approaching this wrong, if you are posting with the correct encoding and your page is saved and processing the correct encoding then it shouldn’t need to escape everything. Ideally we need more context and detail around how you post the data not how you retrieve it. – user692942 Jun 25 '21 at 07:10
  • @easleyfixed You need to understand just changing the meta charset isn't enough that tell's the browser how to interpret the content it doesn't magically make the content that particular encoding so you have to provide the correct encoding in the first place. – user692942 Jun 25 '21 at 08:00

0 Answers0