什么是C字符串的默认编码? [英] What is the default encoding for C strings?

查看:168
本文介绍了什么是C字符串的默认编码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道C字符串中最后一个元素是的char []用'\\ 0'。但如何是字符连接codeD?

I know that C strings are char[] with a '\0' in the last element. But how are the chars encoded?

更新:我发现其中谈到了很多其他编程语言及其编码约定这个凉爽的链接:<一个href=\"http://illegalargumentexception.blogspot.com/2010/04/i18n-comparing-character-encoding-in-c.html\"相对=nofollow>链接

Update: I found this cool link which talks about many other programming languages and their encoding conventions: Link

推荐答案

所有的标准说的问题是,你得到至少52大写和小写拉丁字母字符,数字0到9,符号! #%&放大器;'()* +, - 。/:
; &LT; = GT; ? [\\] ^ _ {| }〜
和空格字符和控制字符重新presenting水平制表符,垂直制表符,并形成饲料。

All the standard says on the matter is that you get at least the 52 upper- and lower-case latin alphabet characters, the digits 0 to 9, the symbols ! " # % & ' ( ) * + , - . / : ; < = > ? [ \ ] ^ _ { | } ~, and the space character, and control characters representing horizontal tab, vertical tab, and form feed.

它说,有关数字编码的唯一的事情就是在一个字节以上适合的,而且每个数字零后的值是大一的previous之一的值。

The only thing it says about numeric encoding is that all of the above fits in one byte, and that the value of each digit after zero is one greater that the value of the previous one.

实际的编码可能是从区域设置继承。可能是一些ASCII兼容。

The actual encoding is probably inherited from your locale settings. Probably something ASCII-compatible.

这篇关于什么是C字符串的默认编码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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