十六进制值0x0B,是无效字符 [英] hexadecimal value 0x0B, is an invalid character

查看:1000
本文介绍了十六进制值0x0B,是无效字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在网站上有标题字段的文本框。有些用户输入了十六进制字符(♂),即vt(垂直制表符 - alt + 11)。在网站上,这个角色是不可见的,但是当我将文本复制粘贴到记事本和记事本++时,我可以看到这个十六进制字符。



我的查询是为什么这个角色是在网站上看不到,进入它的目的是什么?



在SQL服务器结果中我也可以看到这个角色。



我的代码是从Datatable生成Excel,因为这个字符在生成excel时给出错误十六进制值0x0B,是一个无效字符。



先谢谢你。

I have textbox for Title field on website. Some user had entered hexadecimal character (♂) which is vt(vertical tab - alt+11). On Website, this character was invisible, but when I copy pasted the text to notepad and notepad++, I could see this hexadecimal character.

My Query is why this character is not visible on website and what is the purpose of entering it?

In SQL server result also I can see this character.

My code is generating Excel from Datatable, and because of this character it is giving the error "hexadecimal value 0x0B, is an invalid character" while generating excel.

Thank you in Advance.

推荐答案

该字符是C0控制代码(维基百科 [ ^ ])。



That character is a C0 control code (Wikipedia[^]).

Quote:

为什么这个角色在网站上不可见

Why this character is not visible on website

HTML标准定义在渲染输出时必须忽略这些控制代码。要显示相应的符号,可以使用等效的Unicode符号(例如,对于男性符号U,U + 2642)。



The HTML standard defines that these control codes must be ignored when rendering output. To show the corresponding symbols the equivalent Unicode symbols can be used (e.g. U+2642 for the male symbol ♂).

引用:

输入它的目的是什么

如何处理这些控制代码取决于应用程序。某些代码(如换行符,回车符和水平制表符)用于格式化文本。像ESC这样的其他主要用于用户输入。其余的由终端,打印机和串行通信使用。



对于HTML表单,您不应该允许输入任何这些字符(有一些例外,如多行编辑字段,除了回车符和水平制表符之外)。

How such control codes are handled depends on the application. Some codes like line feed, carriage return and horizontal tab are used to format text. Others like ESC are mainly used during user input. The remaining ones are used by terminals, printers, and serial communication.

With HTML forms you should not allow that any of these characters can be entered (with some exceptions like multi-line edit fields which may except carriage return and horizontal tabs).


这篇关于十六进制值0x0B,是无效字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆