How to decode Feedburner result containing \x3c and so on

后端 未结 3 927
既然无缘
既然无缘 2021-01-16 17:50

Feed burner changed their blog service return results that it returns blocks of javascript similar to:

document.write(\"\\x3cdiv class\\x3d\\x22feed

3条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-16 18:16

    Those look like ASCII values, encoded in hex. You could traverse the string, and whenever you find a \x followed by two hexadecimal digits (0-9,a-f), replace it with the corresponding ASCII character. If the string is long, it would be faster to save the result incrementally to a StringBuilder instead of using String.Replace().

    I don't know the encoding specification, but there might be more rules to follow (for example, if \\ is an escape character for a literal \).

提交回复
热议问题