Removing control characters from a UTF-8 string

后端 未结 3 1868
忘了有多久
忘了有多久 2021-01-11 10:03

I found this question but it removes all valid utf-8 characters also (returns me a blank string, while there are valid utf-8 characters plus contro

3条回答
  •  盖世英雄少女心
    2021-01-11 10:44

    If you plan to use the string as a query string, you should consider using the Uri.EscapeUriString() or Uri.EscapeDataString() before sending it out. Note: You might still need to pull out anything from char.IsControl() first?

提交回复
热议问题