[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
question about encoding sequance
From: |
yueyue papa |
Subject: |
question about encoding sequance |
Date: |
Fri, 6 Jun 2008 10:39:31 +0800 |
My changeds gnokii in windows iconv solution. But Is there anyone
could answer my previous encoding question.
win_iconv: (GTK+ depends this )
http://www.gtk.org/download-windows.html
I do not use dll, but using the source code integrated in gnokii.
1> copy the iconv.h to any include file in gnokii
2> add ICONV define in iconv.h
#define ICONV_CONST const
The ICONV_CONST is used in gnokii
3> add the win_iconv.c
The souce code needs to add in gnokii library, because the libary
needs this feature
4> change config.h
#define HAVE_ICONV 1 /*minye.li*/
Try to rebuild the project, see whether there is compiler error. Solve
it if thre is missing part.
5> Change code gsm-encoding.c
static char application_encoding[64] = "";
==>
static char application_encoding[64] = "gb2312";
The data will change flowcontrol in
GNOKII_API const char *gn_char_get_encoding()
In function: static int char_wctomb(char *dst, wchar_t src, MBSTATE *mbs)
cd = iconv_open(gn_char_get_encoding(), "WCHAR_T");
==>
cd = iconv_open(gn_char_get_encoding(), "UTF16");
In function: unsigned int char_unicode_decode(unsigned char* dest,
const unsigned char* src, int len)
wchar_t wc = src[i * 2] << 8 | src[(i * 2) + 1];
==>
wchar_t wc = src[i * 2] | (src[(i * 2) + 1] << 8 );
Rebuild and run again.
The chinese SMS could be displayed.
There are other parts not clear
1> How unicode is encoded in SMS
little indian, or big indian.
2> WCHAR_T has not bee complete changed in code.
cd = iconv_open(gn_char_get_encoding(), "WCHAR_T");
3> how to encode/decode unicode byte sequance in SMS
4> phone book name display has not added UNICODE sequance.
---------- Forwarded message ----------
From: yueyue papa <address@hidden>
Date: Jun 3, 2008 4:57 PM
Subject: question about encoding sequance
To: address@hidden
Hi All,
Is there spec related how the unicode is encode in SMS, using big
indian or litle indian, or the indian flag in the SMS ? After I
changed the wc encode sequance, the iconv works fine. Is this the
encode problem or my problem for how to call iconv. I am in windows
platform and use win_iconv as the code page convert tool.
/* null terminates the string */
unsigned int char_unicode_decode(unsigned char* dest, const unsigned
char* src, int len)
{
int i, length = 0, pos = 0;
MBSTATE mbs;
MBSTATE_DEC_CLEAR(mbs);
for (i = 0; i < len / 2; i++) {
#if 0
wchar_t wc = src[i * 2] << 8 | src[(i * 2) + 1];
//original code
#else
wchar_t wc = src[i * 2] | src[(i * 2) + 1] << 8; //I
changed code
#endif
length = char_uni_alphabet_decode(wc, dest, &mbs);
dest += length;
pos += length;
}
*dest = 0;
return pos;
}
Lee