📄 iphone的中文问题解决.htm
字号:
src="iphone的中文问题解决.files/none.gif" border=0></A> </TD>
<TD style="VERTICAL-ALIGN: top"><SPAN
id=sf_3></SPAN></TD></TR></TBODY></TABLE></DIV>级别: <FONT
color=#555555>骑士</FONT><BR><IMG style="MARGIN: 0.2em 0px 0.6em"
src="iphone的中文问题解决.files/10.gif"><BR><SPAN class=user-info id=showface_3
style="DISPLAY: none"><SPAN class=user-infoWrap><SPAN class=co></SPAN><A
href="http://www.cocoachina.com/bbs/profile.php?action=show&uid=147"><IMG
title=查看作者资料 src="iphone的中文问题解决.files/profile.gif"></A> <IMG title=发送短消息
style="CURSOR: pointer"
onclick="sendmsg('pw_ajax.php','action=msg&touid=147','sf_3')"
src="iphone的中文问题解决.files/message.gif"><IMG title=加为好友
style="CURSOR: pointer" onclick="addfriend('147')"
src="iphone的中文问题解决.files/friends.gif"> <IMG title=对该用户使用道具
style="CURSOR: pointer"
onclick="sendmsg('pw_ajax.php','action=usertool&uid=147','sf_3')"
src="iphone的中文问题解决.files/magic.gif"> <BR>精华: <A class="s4 f9"
href="http://www.cocoachina.com/bbs/search.php?authorid=147&digest=1"
target=_blank>1</A> <BR>发帖: <SPAN class="s1 f9">229</SPAN><BR>威望: <SPAN
class="s2 f9">251 点</SPAN><BR>可可豆: <SPAN class="s3 f9">603
CB</SPAN><BR>贡献值: <SPAN class="s1 f9">11
点</SPAN><BR>iChat:<BR>GTalk:<BR>在线时间:42(小时)<BR><SPAN
class=gray>注册时间:2008-06-13<BR>最后登录:2008-10-16 </SPAN></SPAN></SPAN></TH>
<TH class=r_one id=td_2598
style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 15px; PADDING-LEFT: 15px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; OVERFLOW: hidden; WIDTH: 80%; PADDING-TOP: 5px; BORDER-RIGHT-WIDTH: 0px"
vAlign=top height="100%">
<DIV class=tiptop><SPAN class=fr><A style="CURSOR: pointer"
onclick="fontsize('small','2598')">小</A> <A style="CURSOR: pointer"
onclick="fontsize('middle','2598')">中</A> <A style="CURSOR: pointer"
onclick="fontsize('big','2598')">大</A></SPAN> <SPAN class=fl
style="WHITE-SPACE: nowrap"><A id=quote_2598 title=引用回复这个帖子
href="http://www.cocoachina.com/bbs/post.php?action=quote&fid=6&tid=562&pid=2598&article=3">引用</A>
<A id=recommend_2598 title=推荐此帖
href="http://www.cocoachina.com/bbs/operate.php?action=recommend&tid=562">推荐</A>
<A
href="http://www.cocoachina.com/bbs/post.php?action=modify&fid=6&tid=562&pid=2598&article=3">编辑</A>
</SPAN>
<DIV class=c></DIV></DIV>
<H1 class=fl id=subject_2598></H1>
<DIV class=c id=p_2598></DIV>
<DIV class=tpc_content id=read_2598>繁体转简体的类.<BR><BR>Big5ToGB.h<BR><SPAN
style="COLOR: #0000ff">#import <UIKit/UIKit.h><BR><BR><BR>@interface
Big5ToGB : NSObject {<BR> unsigned char
tbl[30000];<BR>}<BR>- (BOOL)readConvertedTbl;<BR>- (NSString
*)big5ToGB:(NSString
*)big5;<BR>@end<BR></SPAN><BR><BR>Big5ToGB.mm<BR>因为用到c++的方法,所以定义成
mm文件类型.<BR><BR><SPAN style="COLOR: #0000ff">#import
"Big5ToGB.h"<BR><BR><BR>@implementation Big5ToGB<BR><BR>- (Big5ToGB *)
init{<BR> if(self=[super
init]){<BR> memset(tbl, 0 ,
sizeof(tbl));<BR> [self
readConvertedTbl];<BR> }<BR> return
self;<BR>}<BR><BR>- (NSInteger) mapBig5WithChar1:(NSInteger)char1
char2:(NSInteger) char2{<BR> if
(char1>=161)<BR> {<BR> if
(char2>=64 &&
char2<=126)<BR> return
((char1-161)*157+(char2-64))*2;<BR> else
if (char2>=161 &&
char2<=254)<BR> return
((char1-161)*157+(char2-161)+63)*2;<BR> }<BR> return
-1;<BR>}<BR><BR><BR>- (unsigned char *) big5ToGB:(unsigned char *)byteBig5
start:(NSInteger)start
length:(NSInteger)len{<BR> int
i,j;<BR> int
i0,i1;<BR> unsigned char *byteGB=new unsigned
char[len];<BR> memset(byteGB, 0 ,
sizeof(byteGB));<BR> <BR> j=0;<BR> i=start;<BR> int
offset=-1;<BR> while(i<len+start){<BR> i0=(byteBig5<I>>0)?byteBig5<I>:(256+byteBig5<I>);<BR> if
(i<len+start-1)<BR> i1=(byteBig5[i+1]>0)?byteBig5[i+1]:(256+byteBig5[i+1]);<BR> else<BR> i1=0;<BR> offset=[self
mapBig5WithChar1:i0
char2:i1];<BR> if(offset==-1)
//English<BR> {<BR> byteGB[j]=byteBig5<I>;<BR> i++;<BR> j++;<BR> }<BR> else
//Big5<BR> {<BR> byteGB[j+1]=tbl[offset];<BR> byteGB[j]=tbl[offset+1];<BR> i+=2;<BR> j+=2;<BR> }<BR> }<BR> return
byteGB;<BR>}//big5ToGB()<BR>- (NSString *)big5ToGB:(NSString
*)big5{<BR> NSString
*gbStr=big5;<BR> @try{<BR> NSInteger
len=[big5
lengthOfBytesUsingEncoding:big5Encoding_HK];<BR> unsigned
char *buffer=new unsigned
char[len];<BR> memset(buffer,
0,
sizeof(buffer));<BR> NSRange
rg=NSMakeRange(0,
len);<BR>
<BR> [big5 getBytes:(void
*)buffer maxLength:(NSUInteger)len usedLength:(NSUInteger *)NULL
encoding:(NSStringEncoding)big5Encoding_HK
options:(NSStringEncodingConversionOptions)INT_MAX range:(NSRange)rg
remainingRange:(NSRangePointer)NULL];<BR> unsigned
char *byteGB=[self big5ToGB:(unsigned char *)buffer start:0
length:len];<BR> delete
buffer;<BR> gbStr=
[[NSString alloc] initWithBytes:byteGB length:len
encoding:gbEncoding];<BR> delete
byteGB;<BR> }<BR> @catch(NSException
*ex){<BR> NSLog(@"big5ToGB
%@: %@",big5,[ex
reason]);<BR> return
big5;<BR> }<BR> return
[gbStr autorelease];<BR>}<BR><BR><BR>-
(BOOL)readConvertedTbl{<BR> @try{<BR> NSString
*grouppath = [[NSBundle mainBundle] pathForResource:@"Big5ToGB"
ofType:@"tbl"];<BR> NSString
*wholeStr=[NSString stringWithContentsOfFile:grouppath encoding:
NSASCIIStringEncoding error:nil];<BR> int
i=0,value;<BR> NSArray
*strs=[wholeStr
componentsSeparatedByString:@","];<BR> for(NSString
*itemStr in
strs){<BR> NSScanner
*scan=[NSScanner
scannerWithString:itemStr];<BR> unsigned
val;<BR> [scan
scanHexInt:&val];<BR> value=val;<BR> tbl[i+1]=(unsigned
char)(value/256);<BR> tbl<I>=(unsigned
char)(value-tbl[i+1]*256);<BR> i=i+2;<BR> }<BR> return
YES;<BR> }<BR> @catch(NSException
*ex){<BR> NSLog(@"ReadConvertedTbl
%@",[ex
reason]);<BR> return
NO;<BR> }<BR> return
YES;<BR>}//readConvertedTbl();<BR><BR>@end</SPAN><BR><BR>本类中用到的big5Encoding等编码同上一个类<BR><BR><BR><FONT
color=gray>[ 此帖被yakie在2008-10-16 10:08重新编辑
]</FONT></DIV></I></I></I></I></I></TH></TR>
<TR class="tr1 r_one">
<TH
style="BORDER-TOP-WIDTH: 0px; PADDING-LEFT: 15px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; VERTICAL-ALIGN: bottom; BORDER-RIGHT-WIDTH: 0px">
<DIV id=att_193 style="MARGIN: 5px">描述:本类所需要的查表文件<BR>附件: <IMG
src="iphone的中文问题解决.files/zip.gif" align=absBottom> <A
href="http://www.cocoachina.com/bbs/job.php?action=download&pid=2598&tid=562&aid=193"
target=_blank><FONT color=red>Big5ToGB.tbl.zip</FONT></A> (22 K) 下载次数:5
</DIV>
<DIV class="tips tal" id=mark_2598 style="WORD-BREAK: keep-all">
<DIV class="tal s3">本帖最近评分记录:</DIV>
<DIV class=tal>
<LI>贡献值:+5(gagaga) </LI>
<LI>可可豆:+5(gagaga) </LI>
<LI>威望:+5(gagaga)</LI></DIV></DIV>
<DIV class=c id=w_2598></DIV>
<DIV class=tipad><SPAN style="FLOAT: right"><A title=顶端
href="javascript:scroll(0,0)">顶端</A> </SPAN><SPAN class=gray>Posted:
2008-09-19 11:07 | From:广东省深圳市 </SPAN><SPAN><A class=s3 title=回复此楼
style="CURSOR: pointer" onclick="postreply('回 3楼(yakie) 的帖子');">3
楼</A></SPAN> </DIV></TH></TR></TBODY></TABLE></DIV>
<DIV class="t t2">
<TABLE style="BORDER-TOP-WIDTH: 0px; TABLE-LAYOUT: fixed" cellSpacing=0
cellPadding=0 width="100%">
<TBODY>
<TR class=tr1>
<TH class=r_two style="WIDTH: 20%" rowSpan=2><B>nerocoder</B>
<DIV style="MARGIN: 0.3em 0px 0.4em 0.2em"></DIV>
<DIV class=user-pic>
<TABLE
style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px">
<TBODY>
<TR>
<TD width=1><A
onmouseover="mt=setTimeout('read.open(\'showface_4\',\'sf_4\',\'4\');',700);"
style="CURSOR: pointer"
onmouseout=clearTimeout(mt);read.close();><IMG class=pic
src="iphone的中文问题解决.files/none.gif" border=0></A> </TD>
<TD style="VERTICAL-ALIGN: top"><SPAN
id=sf_4></SPAN></TD></TR></TBODY></TABLE></DIV><IMG alt=原创先锋奖
src="iphone的中文问题解决.files/6.gif"> <BR>级别: <FONT
color=#555555>侠客</FONT><BR><IMG style="MARGIN: 0.2em 0px 0.6em"
src="iphone的中文问题解决.files/9.gif"><BR><SPAN class=user-info id=showface_4
style="DISPLAY: none"><SPAN class=user-infoWrap><SPAN class=co></SPAN><A
href="http://www.cocoachina.com/bbs/profile.php?action=show&uid=146"><IMG
title=查看作者资料 src="iphone的中文问题解决.files/profile.gif"></A> <IMG title=发送短消息
style="CURSOR: pointer"
onclick="sendmsg('pw_ajax.php','action=msg&touid=146','sf_4')"
src="iphone的中文问题解决.files/message.gif"><IMG title=加为好友
style="CURSOR: pointer" onclick="addfriend('146')"
src="iphone的中文问题解决.files/friends.gif"> <IMG title=对该用户使用道具
style="CURSOR: pointer"
onclick="sendmsg('pw_ajax.php','action=usertool&uid=146','sf_4')"
src="iphone的中文问题解决.files/magic.gif"> <BR>精华: <SPAN class=s4>0</SPAN>
<BR>发帖: <SPAN class="s1 f9">101</SPAN><BR>威望: <SPAN class="s2 f9">116
点</SPAN><BR>可可豆: <SPAN class="s3 f9">1010 CB</SPAN><BR>贡献值: <SPAN
class="s1 f9">0 点</SPAN><BR>iChat:<BR>GTalk:<BR>在线时间:28(小时)<BR><SPAN
class=gray>注册时间:2008-06-13<BR>最后登录:2008-10-16 </SPAN></SPAN></SPAN></TH>
<TH class=r_one id=td_2611
style="BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 15px; PADDING-LEFT: 15px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; OVERFLOW: hidden; WIDTH: 80%; PADDING-TOP: 5px; BORDER-RIGHT-WIDTH: 0px"
vAlign=top height="100%">
<DIV class=tiptop><SPAN class=fr><A style="CURSOR: pointer"
onclick="fontsize('small','2611')">小</A> <A style="CURSOR: pointer"
onclick="fontsize('middle','2611')">中</A> <A style="CURSOR: pointer"
onclick="fontsize('big','2611')">大</A></SPAN> <SPAN class=fl
style="WHITE-SPACE: nowrap"><A id=quote_2611 title=引用回复这个帖子
href="http://www.cocoachina.com/bbs/post.php?action=quote&fid=6&tid=562&pid=2611&article=4">引用</A>
<A id=recommend_2611 title=推荐此帖
href="http://www.cocoachina.com/bbs/operate.php?action=recommend&tid=562">推荐</A>
<A
href="http://www.cocoachina.com/bbs/post.php?action=modify&fid=6&tid=562&pid=2611&article=4">编辑</A>
</SPAN>
<DIV class=c></DIV></DIV>
<H1 class=fl id=subject_2611></H1>
<DIV class=c id=p_2611></DIV>
<DIV class=tpc_content id=read_2611>感 谢 lz,
很 强 大</DIV></TH></TR>
<TR class="tr1 r_one">
<TH
style="BORDER-TOP-WIDTH: 0px; PADDING-LEFT: 15px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; VERTICAL-ALIGN: bottom; BORDER-RIGHT-WIDTH: 0px">
<DIV class=c id=w_2611></DIV>
<DIV class=tipad><SPAN style="FLOAT: right"><A title=顶端
href="javascript:scroll(0,0)">顶端</A> </SPAN><SPAN class=gray>Posted:
2008-09-19 13:35 | From:北京市 </SPAN><SPAN><A class=s3 title=回复此楼
style="CURSOR: pointer" onclick="postreply('回 4楼(nerocoder) 的帖子');">4
楼</A></SPAN> </DIV></TH></TR></TBODY></TABLE></DIV><A name=lastatc></A>
<DIV class="t t2">
<TABLE style="BORDER-TOP-WIDTH: 0px; TABLE-LAYOUT: fixed" cellSpacing=0
cellPadding=0 width="100%">
<TBODY>
<TR class=tr1>
<TH class=r_two style="WIDTH: 20%" rowSpan=2><B>yakie</B>
<DIV style="MARGIN: 0.3em 0px 0.4em 0.2em"></DIV>
<DIV class=user-pic>
<TABLE
style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px">
<TBODY>
<TR>
<TD width=1><A
onmouseover="mt=setTimeout('read.open(\'showface_5\',\'sf_5\',\'4\');',700);"
style="CURSOR: pointer"
onmouseout=clearTimeout(mt);read.close();><IMG class=pic
src="iphone的中文问题解决.files/none.gif" border=0></A> </TD>
<TD style="VERTICAL-ALIGN: top"><SPAN
id=sf_5></SPAN></TD></TR></TBODY></TABLE></DIV>级别: <FONT
color=#555555>骑士</FONT><BR><IMG style="MARGIN: 0.2em 0px 0.6em"
src="iphone的中文问题解决.files/10.gif"><BR><SPAN class=user-info id=showface_5
style="DISPLAY: none"><SPAN class=user-infoWrap><SPAN class=co></SPAN><A
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -