encoding

https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/ObjCRuntimeGuide/Articles/ocrtPropertyIntrospection.html#//apple_ref/doc/uid/TP40008048-CH101-SW6

Objective-C Type Encodings 属性类型编码

Code

Meaning

c

char

i

An int

s

short

l

long

l is treated as a 32-bit quantity on 64-bit programs.

q

long long

C

An unsigned char

I

An unsigned int

S

An unsigned short

L

An unsigned long

Q

An unsigned long long

f

float

d

double

B

A C++ bool or a C99 _Bool

v

void

*

A character string (char *)

@

An object (whether statically typed or typed id)

#

A class object (Class)

:

A method selector (SEL)

[array type

An array

{name=type...}

A structure

(name=type...)

A union

bnum

A bit field of num bits

^type

A pointer to type

?

An unknown type (among other things, this code is used for function pointers)

Objective-C method encodings 方法参数类型

Code

Meaning

r

const

n

in

N

inout

o

out

O

bycopy

R

byref

V

oneway

Property Type String (property_getAttributes)属性修饰符的编码

Code

Meaning

R

The property is read-only (readonly).

C

The property is a copy of the value last assigned (copy).

&

The property is a reference to the value last assigned (retain).

N

The property is non-atomic (nonatomic).

G<name>

The property defines a custom getter selector name. The name follows the G (for example, GcustomGetter,).

S<name>

The property defines a custom setter selector name. The name follows the S (for example, ScustomSetter:,).

D

The property is dynamic (@dynamic).

W

The property is a weak reference (__weak).

P

The property is eligible for garbage collection.

t<encoding>

Specifies the type using old-style encoding.



网友netstarry写的一个处理字符编码的类,很好的解决了php中字符转换的问题 前一阵子见到了qiushuiwuhen君的关于gbk,unicode,big5的转换的文章 但是多少有一些不太大的问题 于是我设计了一个负责字符转换的类,修正了其中的一些不足,增加了部分功能,以后我会不断扩充该类,来支持更多的字符集 增加了如下几点: unicode->gbk 符号部分的转换 欧元符(?的识别 big5,Unicode,GBK之间的相互转换,前提是只转换共同的字符集部分, 使用说明: 暂时程序支持以下字符编码方式: GBK,BIG5,UTF-16BE(Unicode big-endian字节顺序),UTF-16LE(Unicode little-endian字节顺序),UTF-8 默认输入编码方式为GBK,默认输出编码方式为UTF-16BE; 该类别提供两个函数用来修改输入和输出编码方式: 修改输入编码方式 boolean SetGetEncoding(string $GetEncoding) 修改输出编码方式 boolean SetToEncoding(string $ToEncoding) 函数参数只能使用上述5种编码方式,区分大小写,如GBK不能写成gbk 如果设置成功,返回true,如果使用了错误的编码名,返回false,并现实错误信息 函数 string EncodeString(string $String) 负责进行字符编码转换,返回转换后的字符串 使用前,请将var $FilePath=\"\"变量该为该程序文件的绝对路径,否则将会找不到数据文件 例子: 将gbk编码的字符串转化为UTF-8编码: $s=\"GBK编码\"; $CharEncoding=new Encoding(); $CharEncoding->SetGetEncoding(\"GBK\")||die(\"编码名错误\"); $CharEncoding->SetToEncoding(\"UTF-8\")||die(\"编码名错误\"); echo $CharEncoding->EncodeString($s); 在浏览器中使用UTF-8编码察看,将会看到正确的字符.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值