UTF-16字符串结束 [英] UTF-16 string terminator

查看:439
本文介绍了UTF-16字符串结束的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是一个UTF-16字符串字符串终止序列?

What is the string terminator sequence for a UTF-16 string?

编辑:

让我改一下这个问题,试图澄清。公司如何调用 wcslen()工作?

Let me rephrase the question in an attempt to clarify. How's does the call to wcslen() work?

推荐答案

统一code没有定义字符串终止符。您的环境或语言一样。例如,C字符串使用为0x0作为一个字符串结束,在.NET语言不使用一个字符串结束在所有 - 它们定义在字符串类单独的值来存储长度的字符串。

Unicode does not define string terminators. Your environment or language does. For instance, C strings use 0x0 as a string terminator, where .NET languages do not use a string terminator at all - they define a separate value in the String class to store the length of the string.

要回答你的第二个问题, wcslen 查找终止 L'\\ 0'字符。这是我读它,是 0×00 字节的任意长度,根据不同的编译器,但很可能会在这两个字节 0×00 0×00 如果你使用UTF-16 (编码 U + 0000,'NUL'

To answer your second question, wcslen looks for a terminating L'\0' character. Which as I read it, is any length of 0x00 bytes, depending on the compiler, but will likely be the two-byte sequence 0x00 0x00 if you're using UTF-16 (encoding U+0000, 'NUL')

这篇关于UTF-16字符串结束的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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