xml 中如果包含部分 ascii 控制字符(小数字)则 chrome会报告如下类型错我:

This page contains the following errors:
error on line 20 at column 89: Input is not proper UTF-8, indicate encoding !
Bytes: 0x08 0xE8 0xBA 0xB2
Below is a rendering of the page up to the first error.

解决办法:replace 这些字符

 public static string ReplaceXMLInvaidChar(string xmlStr)
{
return Regex.Replace(xmlStr, "[\x00-\x1F\x7F]",""); }

  

原因:XML 规范不支持如下字符
#x0 - #x8 (ASCII 0 - 8)
#xB - #xC (ASCII 11 - 12)
#xE - #x1F (ASCII 14 - 31)

参看文档:https://support.microsoft.com/en-us/kb/315580

原文地址:https://blog.csdn.net/isaisai/article/details/53899089

Input is not proper UTF-8, indicate encoding !错误处理的更多相关文章

  1. php加载xml编码错误,“Error: Input is not proper UTF-8, indicate encoding! ”

    最近在给php中解析xml的时候,抛出一个错误: "Warning: DOMDocument::load(): Input is not proper UTF-8, indicate enc ...

  2. 十二 INPUT逻辑视图的配置,回显错误信息

    Action接口中提供了五个逻辑视图的名称 SUCCESS ERROR LOGIN INPUT:input在某些拦截器会使用 NONE 配置逻辑视图:struts_demo2.xml,配置后出现错误信 ...

  3. 【转载】解决 Subversion 的 “svn: Can't convert string from 'UTF-8' to native encoding” 错误

    转载自:http://blog.csdn.net/shaohui/article/details/3996274 在google code 上创建了一个新的项目, 用Windows 下面的tortoi ...

  4. SAS使用SPD引擎并报Encoding错误

     ERROR: Unable to open data file because its file encoding differs from the SAS session encoding and ...

  5. UnSupported Encoding错误

    学习struts2的时候碰到tomcat报错:org.apache.jasper.JasperException: Unsupported encoding:  UTF-8,原因是jsp文件中的pag ...

  6. Zend Studio出现 Some characters cannot be mapped using "GBK" character encoding 错误

    解决办法: Window->Profermance->General->Content Types->Text看目录下面的每个文件,包括子目录里面 Default encodi ...

  7. Python input 使用

    Python 3.0 中使用"input" , Python 2.0 中使用"raw_input"Python 3.5: #!C:\Program Files\ ...

  8. 已解决】Sublime中运行带input或raw_input的Python代码出错:EOFError: EOF when reading a line(转)

    [问题] 在折腾: [已解决]Sublime Text 2中运行Python程序出错:The system cannot find the file specified 的过程中,虽然解决了找不到py ...

  9. node进阶| 解决表单enctype="multipart/form-data" 时获取不到Input值的问题

    今天在学习node踩到一个坑:form设置enctype="multipart/form-data"上传文件时,无法获取到表单其他input的值. 因为之前上传文件用的是 form ...

随机推荐

  1. javascript switch continue break 执行语句

    1:switch 关键字段:switch(n).case.break.default switch(n) :n是一个表达式 或者是一变量,用来与其下的各种case进行匹配,比如:此时的day输出的是 ...

  2. win32 获取本机网卡信息(MAC地址,IP地址等)

    由于一个需求需要获取网卡的MAC地址,就搜了一下,大部分都是COPY来COPY去的一些代码,有很多甚至不能直接运行或有还有内存泄漏.自己查了一下MSDN然后封装了一下: 需要注意,一个机器可能有多个网 ...

  3. Poj 1631 Bridging signals(二分+DP 解 LIS)

    题意:题目很难懂,题意很简单,求最长递增子序列LIS. 分析:本题的最大数据40000,多个case.用基础的O(N^2)动态规划求解是超时,采用O(n*log2n)的二分查找加速的改进型DP后AC了 ...

  4. 蓝桥杯 算法训练 ALGO-146 4-2找公倍数

    算法训练 4-2找公倍数   时间限制:1.0s   内存限制:256.0MB        查看参考代码 问题描述 这里写问题描述. 打印出1-1000所有11和17的公倍数. 样例输入 一个满足题 ...

  5. HDU 1863 畅通工程(Prim,Kruskal,邻接表模板)

    畅通工程 Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submis ...

  6. 第八课 go的条件语句

    1  if ... else package main import "fmt" func main() { flag:= { fmt.Println("flag > ...

  7. webscheduler 开源定时服务和延迟服务

    源码地址:https://gitee.com/eabeat/webscheduler 架构上采用 asp.net + access ,实现简单的管理界面,可以维护调用API,查看日志等功能.内核采用Q ...

  8. hibernate Annotation 以及注解版的数据关联

    目的是不写xxx.hbm.xml映射文件,使用注解 主配置文件还是要有hibernate.cfg.xml <?xml version="1.0" encoding=" ...

  9. CreateMutex实现只能打开一个客户端

    #include "stdafx.h" #include <Windows.h> #include <iostream> using namespace s ...

  10. VC用Beep整几首歌听听~~~

    //生日快乐歌 #include "stdafx.h"#include <windows.h>void main(void)   {       unsigned FR ...