i trying replace non-printable characters ie extended ascii characters huge string.
foreach (string line in file.readlines(txtfilename.text)) { messagebox.show( regex.replace(line, @"\p{cc}", => string.format("[{0:x2}]", " ") )); ; }
this doesnt seem working.
ex: aaÂaa should converted aa aa
assuming encoding utf8 try this:
string strreplacedval = encoding.ascii.getstring( encoding.convert( encoding.utf8, encoding.getencoding( encoding.ascii.encodingname, new encoderreplacementfallback(" "), new decoderexceptionfallback() ), encoding.utf8.getbytes(line) ) );
Comments
Post a Comment