[英]How to insert these non-ascii characters as html content?
I found this Sublime Text 3 Plugin to insert emojis into the editor. 我发现这个Sublime Text 3插件将emojis插入到编辑器中。
https://packagecontrol.io/packages/Emoji https://packagecontrol.io/packages/Emoji
Is this what you are looking for? 这是你想要的?
As long as you save the file you're editing using the UTF-8
character encoding, and make sure it is delivered with a suitable content type header, such as Content-Type: text/html; charset=utf-8
只要您使用UTF-8
字符编码保存正在编辑的文件,并确保它与适当的内容类型标头一起提供,例如Content-Type: text/html; charset=utf-8
Content-Type: text/html; charset=utf-8
you don't need to do anything at all. Content-Type: text/html; charset=utf-8
你根本不需要做任何事情。
Another option, as others have noted, is adding them as HTML entities instead. 正如其他人所指出的,另一种选择是将它们添加为HTML实体 。 In order to do that you would need to know their character codes. 为此,您需要知道他们的字符代码。 How to do that differs between different environments, but there are multiple questions on SO about that . 如何做到这一点在不同的环境之间有所不同,但关于这一点有很多问题 。
Here's how you could do it in Python (Python 3, you'd need to use u""
strings in earlier versions): 以下是使用Python的方法(Python 3,你需要在早期版本中使用u""
字符串):
chars = [
"😀",
"😐",
"😳",
"😫",
"💩"
]
for char in chars:
print("{}: &#{:02x};".format(char, ord(char)))
You can represent Emoticons in html as its unicode symbol formatted as 򪪪
您可以将html中的表情符号表示为其格式为򪪪
unicode符号򪪪
( some unicode list ) ( 一些unicode列表 )
<div>😁</div>
I am using sublime text as editor and when you see it on browser it should look like these: 我使用sublime文本作为编辑器,当你在浏览器上看到它时,它应该如下所示:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.