Linux -Blue forest free software | Return to home page | Site Map | Search WWW | Contact Us |
Your current position : Homepage > Free Software > Technological exchanges >Application Programming


    

Blue Forest http://www.lslnet.com at 10:18 on June 6, 2006


How converted to unicode ASCII?

FOSS It! Calling function without any operating system, but not to the code table, too!

I was always writing to the address Unicode encoding to GB, patients gave me the code level, lest I find

Debugging procedure FressBSD/Linux, Windows users can amend several variable types and header files

Function names :
Int strUnicode2GB (char *strSourcer, char *strDest, int n)

GB Unicde string of code conversion, the number of returned Chinese
Input (Unicode source string, string GB2312/ASCII hybrid coding, Unicode byte count to be even!)

[code]

#include "Sys/types.h>;

Const unsigned short int Unicode_GB2312[][2] =
{

/*Unicode, GB||ASCII, MEMO*/
0x0000,0x0040, LEAVES OF 13 SPECIES OF LAURACEAE 0 COMMERCIAL AT @ */
0x0001,0x00A3, LEAVES OF 13 SPECIES OF LAURACEAE £ 1 POUND SIGN */
0x0002,0x0024, LEAVES OF 13 SPECIES OF LAURACEAE $ 2 DOLLAR SIGN */
0x0003,0x00A5, LEAVES OF 13 SPECIES OF LAURACEAE 3 sen SIGN ¥ */
0x0004,0x00E8, LEAVES OF 13 SPECIES OF LAURACEAE 4 LATIN SMALL LETTER E WITH GRAVE d'*/

.............
.............
Google asked to pass the code table too long inquiry, the more
Or to ask me to stevenkoh@sohu.com

0xFF5C,0xA3FC, LEAVES OF 13 SPECIES OF LAURACEAE '|' ->; 65,372 */
0xFF5D,0xA3FD, LEAVES OF 13 SPECIES OF LAURACEAE ')' ->; 65,373 */
0xFF5E,0xA1AB, LEAVES OF 13 SPECIES OF LAURACEAE '~' ->; 65,374 */
0xFFE0,0xA1E9, LEAVES OF 13 SPECIES OF LAURACEAE '¢' ->; 65,504 */
0xFFE1,0xA1EA, LEAVES OF 13 SPECIES OF LAURACEAE '£' ->; 65,505 */
0xFFE3,0xA3FE, LEAVES OF 13 SPECIES OF LAURACEAE 'Z' ->; 65,507 */
0xFFE5,0xA3A4, LEAVES OF 13 SPECIES OF LAURACEAE '¥' ->; 65,509 */


};

U_int16_t Unicode2GBcode (u_int16_t iUnicode)
{
Int i, j, n;

Switch (iUnicode) (
Case 0x0002 :
Return 0x24;
Break;
0x000a case :
Return 0xa;
Break;
0x000d case :
Return 0xd;
Break;
Case 0x0040 :
Return 0xA1;
Break;
}

If ((iUnicode>;=0x20&&iUnicode<=0x5a) | | (iUnicode>;=0x61&&iUnicode<=0x7a)) return iUnicode;


For (≥, j, n=sizeof (Unicode_GB2312) /sizeof (Unicode_GB2312[0]) -1;n>;0;n>;>;=1, ++j) (

If (Unicode_GB2312[i][0]==iUnicode) return Unicode_GB2312[i][1];

If (j>;1) (
If (Unicode_GB2312[i-1][0]==iUnicode) return Unicode_GB2312[i-1][1];
If (Unicode_GB2312[i+1][0]==iUnicode) return Unicode_GB2312[i+1][1];
}

If (Unicode_GB2312[i][0]<iUnicode) i=i+n;
Else i=in;
}

If (Unicode_GB2312[i][0]==iUnicode) return Unicode_GB2312[i][1];
If (Unicode_GB2312[i-1][0]==iUnicode) return Unicode_GB2312[i-1][1];
If (Unicode_GB2312[i+1][0]==iUnicode) return Unicode_GB2312[i+1][1];

Return 0 4003rd unsuccessful conversion
}


LEAVES OF 13 SPECIES OF LAURACEAE Unicde string conversion to GB code, the number of returned Chinese */
Int strUnicode2GB (const char *strSourcer, const char *strDest, int n)
{
Char cTmp;
U_int16_t hz, tmphz;

Char *pSrc;
Char *pDest;

Int Rifa


For (≥, pSrc=strSourcer, pDest=strDest;n>;0;n-=2, pSrc+=2, ++i, ++pDest) (

Hz=0;
Hz=*pSrc<<8| (* (pSrc+1) &0x00FF);
Tmphz=Unicode2GBcode (hz);

If (!tmphz||tmphz>;0x7F&&tmphz<0xFF) (
*pDest= '. ';
Continue;
}
Else if (tmphz>;0x00&&tmphz<=0x7F) (
CTmp=tmphz;
*pDest=cTmp;
}
Else{
CTmp=tmphz;
*pDest= (Tmphz>;>;=8);
++pDest;
*pDest=cTmp;
}
}

*pDest= '\0';
Return Rifa

}
[/code]
We want to help you! As GB->;Unicode, I think even if the gateway can support anyway.

How converted to unicode ASCII?

Function names :
Int strUnicode2GB (char *strSourcer, char *strDest, int n)

GB Unicde string of code conversion, the number of returned Chinese
Input (Unicode source string, string GB2312/ASCII hybrid coding, Unicode byte count to be even!)

How converted to unicode ASCII?

Thank you upstairs paper
Our reference

How converted to unicode ASCII?

8)

How converted to unicode ASCII?

Conversion win easily and there is no need for any code table
Apart from the Unix code table have no other alternative?

How converted to unicode ASCII?

"Hz=*pSrc<<8| (* (pSrc+1) &0x00FF); "The two bytes of unicode string conversion function as input, do not understand or see if you can explain the unicode string?
In addition to the encoded gb2312 be how can we make the normal characters show?
"*pDest= (Tmphz>;>;=;" this source faults can be replaced?

How converted to unicode ASCII?

Help you change a bit and use code contains facilitate everyone to see.

Iconv reservoir contains a variety of other coding conversion, Linux is already part of the pool of glibc.

The other os Unix can use a separate installation.

How converted to unicode ASCII?

-->     


Hello, using Windows machines, and whether this UNICODE->;GB codes, do not quite understand the above, thank you

How converted to unicode ASCII?

The simple ASCII to ASCII conversion unicode, the first byte 0 can be removed.
Chinese conversion, as follows, first of all characters printed to a text file and then use ultraedit transferred into unicode format conversion can control two papers, not because the document can be loaded into memory all! However, when compared to the attention of byte order



 Privacy Policy  Copyright © 1999-2000 LSLNET.COM. All rights reserved. Blue Forest website owners. E-mail : Webmaster@lslnet.com