本文介绍了如何编码U + FFFD以做替换?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在一个文本文件中,我从一个我不能控制的源获得,并且哪个文本内容周期性地改变,并且我必须通过重新下载和处理来补偿,char U + FFFD经常(但不总是)

In a text file I obtain from a source I do not control, and which text content changes periodically and I have to compensate by re-downloading and processing, the char U+FFFD occurs frequently (but not always) when what is meant is the single quote or ' character.

如何对替换操作进行编码,以便用C#中的实际单引号替换U + FFFD。我想象类似:

How can I encode a replace operation so as to replace the U+FFFD with an actual single-quote in C#. I envision something like:

string s = s.Replace("U+FFFD", "'");

显然,我应该使用处理char的重载,但是我不知道如何编码U + FFFD,或者这个单引号!

Clearly I should use the overload that deals with char, but I am not sure how to encode the U+FFFD, or for that matter, the single quote!

推荐答案

string s = s.Replace('\uFFFD','\'');

这篇关于如何编码U + FFFD以做替换?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-23 21:08