UFT-8 还是 utf-8 ?结束标记处有或没有空格? TAB 还是空格?
我想知道:
我应该使用 utf-8 大写还是小写,为什么或者在什么情况下我需要大写?
为了节省空间而删除元素的结尾空格是否错误?
至
考虑到我有 200MB 到 1GB 大小的大文件
如果我想节省空间,我应该使用 TAB 还是 SPACE 吗?
I was wondering about:
Should I use utf-8 upper or lower case and why or for what cases I need it in upper case ?
Is it wrong to remove the ending space of an element to save space ?
<myElement myAttribute="0" />
to
<myElement myAttribute="0"/>
That is considering I have Huge files from 200MB to 1GB size
Should I use TAB or SPACE if I wanted to save space ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我假设您指的是 XML 声明:
他 IANA 字符集 页面顶部附近有这样的说明:
因此,我得出结论,
encoding="UTF-8"
和encoding="utf-8"
在 XML 声明中是等效的。这些表达式中的每一个都代表一个没有内容的元素。它们在语义上都是等效的。在第一个表达式中,
/>
前面的空格字符并不重要。 (尽管您经常会看到为样式而添加的空格字符。)在UTF-8编码(还有ASCII)中,
TAB
和SPACE
各占一个字节。因此,如果您使用多个SPACE
字符进行缩进,则将每组SPACE
字符替换为单个TAB
字符将节省存储空间(或减少网络传输中 XML 文档的大小)。I presume you are referring to the XML declaration:
he IANA Character Sets page says this near the top:
Therefore, I conclude that
encoding="UTF-8"
andencoding="utf-8"
are equivalent in the XML declaration.Each of these expressions represents an element that has no content. They are all semantically equivalent. In the first expression the space character that precedes
/>
is not significant. (Although frequently you'll see that space character added for style.)In the UTF-8 encoding (as well as ASCII),
TAB
andSPACE
each occupy one byte. So, if you are using multipleSPACE
characters to indent, replacing each group ofSPACE
characters with a singleTAB
character would save storage space (or reduce the size of the XML document in a network transmission).