Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

javaÓëC++ÖÐÎÄ×Ö·ûµÄÎÊÌâ

 
ÖÐÎĵıàÂë³£ÓõÄÓÐ3ÖÖ¸ñʽ£º1£©gb2312(¾ÍÊÇasciiÂ뷽ʽ£¬Ò²Ëµansi) 2)unicode 3)utf-8
c++Ò»°ã²ÉÓÃanciiÂ룬¶øjavaÒ»°ã²ÉÓÃunicode£¬¶øSymbianC++£¨ÒÔºó¼ò³Æsymbian£©²ÉÓÃunicode»òutf-8
±ÈÈ纺×Ö“ºÃ”£º unicodeΪ“7D 59”£¬¶øasciiΪ“BA C3”, utf-8±àÂëΪ3¸ö×Ö½Ú¡£
ÖÕ¶ËÄã¿ÉÒÔÑ¡ÔñʹÓÃchar *, unsigned char *, µ«ÊÇÕâ²»ÊÇÍƼöʹÓõģ¬ºÜ¶àʱºò´¦ÀíµÄʱºòÈç½çÃæµÈÐèҪת»¯ÎªÖն˵Ä×Ö·û±àÂë¸ñʽ¡£
ÏÖÔÚ·Ö4²¿·Ö½²½â×Ö·û±àÂëת»¯£¨Àý×Ó¼ÙÉ裬javaºÍsymbian¼ä²ÉÓÃutf-8£¬c++ºÍsymbianÖ®¼ä²ÉÓÃASCIIÂ룩£º
1) Symbian -> Java ·¢Ëͺ¬ÓÐÖÐÎĵÄÏûÏ¢  
   ÎÒÃǼÙÉèÄãµÄSymbianµÄ·¢ËÍÏûÏ¢µÄ½Ó¿Ú²ÉÓõÄÊÇHBufC8 * (utf-8)
   ÄÇôÄãÔÚ·¢ËÍÄãµÄÏûϢ֮ǰ£¬ÐèÒª½«Êý¾Ýת»¯Îªutf-8¸ñʽ£¬
   ÀýÈ磬Äã¿ÉÒÔʹÓÃCnvUtfConverter::ConvertfromUnicodeToUtf8()½«½çÃæµÄTBufת»¯Îª8λµÄutf-8¸ñʽ£¬×ª»¯¹ý³ÌÖÐÄãÒªÓÈÆä×¢Ò⣬ΪHBufC8 * ¿ª±ÙµÄÄÚ´æÓ¦¸ÃÊÇTBuf³¤¶ÈµÄ2±¶!
  
ÖÁÓÚÖÕ¶ËÈçºÎ´¦ÀíJava¶Ë·¢Ë͵ÄÏûÏ¢¾Í²»ÑÔ¶øÓ÷ÁË£¬Javaͨ³£»áÖ»·¢ËÍÒ»¸öString,
Ò²¾ÍÊÇÒ»¸öUnicode×Ö·û´®£¬Õâ¸öʱºòÒ»°ãSymbian»áÒÔTDes8½ÓÊÕ£¬Êµ¼ÊÉϽÓÊÕµÄÊý¾ÝÊÇUnicodeµÄ¶ø²»ÊÇutf-8µÄ£¬µ«ÊÇ
SymbianÖ§³ÖÕâÖÖ¸ñʽ£¬ËùÒÔ¿ÉÒÔÖ±½Ó¾Í°´ÕâÖÖ·½Ê½´¦Àí£¬¶ø²»ÐèҪת»¯¡£µ±È»£¬ÒªÔÚ½çÃæÉÏÏÔʾµÄ»°»¹ÊÇÐèÒªCnvUtfConverter::
ConvertToUnicodefromUtf8())  
2) Java -> Symbian ·¢Ëͺ¬ÓÐÖÐÎĵÄÏûÏ¢
   ·þÎñÆ÷¶Ë
µ±È»Ò²Òª´¦ÀíÖÐÎÄÁË£¬¸Õ²ÅÒѾ­ËµÁË£¬·¢Ë͵ÄʱºòÄã¿ÉÒÔÖ±½Ó·¢ËÍString
(Unicode)£¬ÈÃSymbianÈ¥½âÎö£¬µ«ÊǽÓÊվ͵ÃÊ®·ÖСÐÄ£¡£¡ÖÕ¶ËSymbian¹ýÀ´µÄÊÇHBufC8*
(utf-8)¸ñʽ£¬JavaÇмɲ»ÒªÖ±½ÓÓÃStringÈ¥½ÓÊÕ£¬ÐèÒª°´×Ö½Ú½ÓÊÕ£¬È»ºóÔÙ½«ÕâЩ×Ö½Ú½âÎö³Éutf-8,ÔÙת»¯ÎªString,Óм¸Ìõ¼òµ¥
µÄÓï¾ä¿ÉÒÔÍê³ÉÕâ¸ö²Ù×÷£º
   byte b3[] £½ ...; //À´×ÔSymbianµÄutf-8×Ö½Ú
   DataInputStream dis=new DataInputStream(new ByteArrayInputStream(b3));
   String chinastring = dis.readUTF();
3) Symbian -> C++ ·¢Ëͺ¬ÓÐÖÐÎĵÄÏûÏ¢
   ÏÖÔÚÎÒÃÇÔÙÀ´ÌÖÂÛÏ£¬ÈçºÎ½«SymbianµÄÏûÏ¢·¢Ë͸øC++×ÓϵͳÄØ£¬ ÏÔÈ»£¬C++×ÓϵͳÊÇ°´ÕÕchar */unsigned char *´¦Àí×Ö·û´®µÄ£¬Ò²¾ÍÊÇASCIIÂ뷽ʽ£¨ÖÐÎľÍÊÇÀ©Õ¹µÄANSI¼´GB2312£


Ïà¹ØÎĵµ£º

ÓÃJava¿ª·¢´úÀí·þÎñÆ÷

 
´úÀí·þÎñÆ÷µÄÓ¦Ó÷dz£¹ã·º¡£±ÈÈ磬ÔÚÆóÒµÍøÄÚ²¿£¬Ëü¿ÉÒÔÓÃÀ´¿ØÖÆÔ±¹¤ÔÚ¹¤×÷ʱä¯ÀÀµÄInternetÄÚÈÝ£¬×èÖ¹Ô±¹¤·ÃÎÊijЩÀàÐÍ
µÄÄÚÈÝ»òijЩָ¶¨µÄÍøÕ¾¡£´úÀí·þÎñÆ÷ʵ¼ÊÉÏ°çÑÝ×Åä¯ÀÀÆ÷ºÍWeb·þÎñÆ÷Ö®¼äµÄÖмäÈ˵ĽÇÉ«£¬Äܹ»¶Ôä¯ÀÀÆ÷ÇëÇó½øÐи÷ÖÖ¸÷ÑùµÄ´¦Àí£¬Äܹ»¹ýÂ˹ã¸æºÍ
Cookie£¬Äܹ»Ô¤ÏÈÌáÈ¡WebÒ³Ã棬ʹµÃä¯ÀÀÆ÷·ÃÎÊ ......

C/C++——С±à̸CÓïÑÔº¯ÊýÄÇЩÊÂ(22)

C³ÌÐòÊÇÓÉÒ»×é»òÊDZäÁ¿»òÊǺ¯ÊýµÄÍⲿ¶ÔÏó×é³ÉµÄ¡£ º¯ÊýÊÇÒ»¸ö×ÔÎÒ°üº¬µÄÍê³ÉÒ»¶¨Ïà¹Ø¹¦ÄܵÄÖ´ÐдúÂë¶Î¡£ÏÂÃæС±àºÍ´ó¼Ò·ÖÏíÏÂCÓïÑÔÖеĺ¯Êý¡£
 
1.    setmemº¯Êý
setmemº¯ÊýµÄ¹¦ÄÜÊÇ´æÖµµ½´æ´¢Çø£¬ÆäÓ÷¨Îª£ºvoid setmem(void *addr, int len, char value);³ÌÐòʵÀýÈçÏ£º
#include <stdio.h& ......

javaµÚ10Ìì´úÂë(Ïß³Ì)

/******************TestThread.java begin****************************/ 
public class TestThread {
 public static void main(String[] args) {
  // TODO Auto-generated method stub
  Object obj=new Object();
  
  print p=new print(obj);
   ......

javaÄ£ÄâÎ趯×Ö·û

 Ô´´úÂ룺
import java.applet.Applet;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
public class brandishString extends Applet implements Runnable, MouseListener {
String str; // ÒªÏÔʾµÄ×Ö·û ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ