| |

VerySource

 Forgot password?
 Register
Search
View: 2105|Reply: 6

Hexadecimal conversion Chinese

[Copy link]

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-12-14 10:00:02
| Show all posts |Read mode
How to convert ASCII into Chinese?
What should I do if the hexadecimal number is converted into Chinese?
Is there any solution?
The following is the hexadecimal number,
02 50 4B 31 30 32 43 42 44 41 42 34 42 41 42 42 41 41 32 30 32 30 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 42 33 46 35 33 39 33 36 42 43 42 36 32 30 32 30 32 30 32 30 32 30 32 30 39 38 33 30 32 37 30 31 33 33 33 30 34 32 30 31 33 38 38 30 33 37 30 31 33 35 38 30 33 34 30 31 33 34 38 30 33 33 30 31 32 34 33 30 33 33 30 31 30 33 39 30 33 32 30 31 32 33 33 30 33 32 30 31 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 4 6 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 03 2C 0D
Reply

Use magic Report

0

Threads

13

Posts

12.00

Credits

Newbie

Rank: 1

Credits
12.00

 China

Post time: 2020-12-14 23:45:01
| Show all posts
From the hexadecimal numbers you gave, there should be no Chinese characters in it.

The first digit of the Chinese code in the GB2312 code is 1, which means that there should be 0x80 or more.
Reply

Use magic Report

0

Threads

16

Posts

16.00

Credits

Newbie

Rank: 1

Credits
16.00

 China

Post time: 2020-12-15 13:30:01
| Show all posts
What I said upstairs is right, I can't see, these are just ordinary characters
46 If it is decimal, it is ".", if it is hexadecimal, it should be "F". What Chinese is there?
Reply

Use magic Report

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

 Author| Post time: 2020-12-15 15:15:01
| Show all posts
Is there a function to convert it? Can HTTPDecode()

The hexadecimal number in is %D6D0. How to convert between them? ? ? ? ? ? ? ? ,
Reply

Use magic Report

0

Threads

2

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-12-19 10:00:01
| Show all posts
extern "C" __declspec(dllexport) __int16 __stdcall HTOA(char *H,char *A,__int16 alen)
{
__int16 len=alen/2;
__int16 i,j;
char hi;
char lo;
j=0;
for(i=0;i<len;i++)
{
hi=H[i];
hi=(hi>>4)&0x0f;
lo=H[i]&0x0f;
if(hi<0x0a)A[j]=0x30+hi;
else if(hi<=0xf)A[j]=0x37+hi;
j++;
if(lo<0x0a)A[j]=0x30+lo;
else if(lo<=0xf)A[j]=0x37+lo;
j++;
}
return j;
}
Reply

Use magic Report

0

Threads

2

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-12-19 11:30:01
| Show all posts
The one above is reversed. The following is correct
extern "C" __declspec(dllexport) __int16 __stdcall ATOH(char *A,char *H,__int16 hlen)
{
__int16 len=2*hlen;
__int16 alen=strlen(A);
__int16 i,j;
char *Au = new char[len];
i=0;
if(alen<len)
{
for(i=0;i<(len-alen);i++)
{
Au[i]=0x30;
}
}
for(;i<len;i++)Au[i]=A[i];
j=0;
for(i=0;i<len;i++)
{
if((Au[i]>0x2f)&&(Au[i]<0x3a))
{
H[j]=Au[i]-0x30;
H[j]=(H[j]<<4)&0xf0;
}
else if((Au[i]>0x40)&&(Au[i]<0x47))
{
H[j]=Au[i]-0x37;
H[j]=(H[j]<<4)&0xf0;
}
else if((Au[i]>0x60)&&(Au[i]<0x67))
{
H[j]=Au[i]-0x57;
H[j]=(H[j]<<4)&0xf0;
}
else H[j]=0;
i++;
if((Au[i]>0x2f)&&(Au[i]<0x3a))
{
H[j]+=Au[i]-0x30;
}
else if((Au[i]>0x40)&&(Au[i]<0x47))
{
H[j]+=Au[i]-0x37;
}
else if((Au[i]>0x60)&&(Au[i]<0x67))
{
H[j]+=Au[i]-0x57;
}
j++;
}
delete []Au;
return j;
}

transfer:
//-----------------------------------Get name
static unsigned char data[2048];
sTemp1 = "";
sName = "";
iTemp1 = byData[giarIDToAdd[i] + 8];
if(iTemp1 != 0xFF){
for(j=8;j<=15;j++){
if(byData[giarIDToAdd[i] + j]!=32){
iTemp1 = byData[giarIDToAdd[i] + j];
sTemp1 += StrPas(cbf_10_16(iTemp1));
}
}
ATOH(sTemp1.c_str(),data,sTemp1.Length()/2);

sPY = StrPas(cbf_MakeSpellCode(data,2,255));
sName = StrPas(data);
}



//-----------------------------------Get name
sTemp1 = "";
sName = "";
            sPY = "";
            if(byData[iPos + 8] != 0xFF){
                BYTE byName[9];
                memset(byName,0,9);
                for(j=0;j<8;j++){
                    if(byData[iPos + 8 + j] != 0xFF){
                        //if(byData[iPos + 8 + j] <0x20){
                        // byName[j] = 0x20;
                        //}
                        //else{
                            byName[j] = byData[iPos + 8 + j];
                        //}
                    }
                }
                char *chName = (char *)byName;
                sName = static_cast<AnsiString>(chName);
                sPY = StrPas(cbf_MakeSpellCode(chName,2,255));
            }
Reply

Use magic Report

0

Threads

13

Posts

12.00

Credits

Newbie

Rank: 1

Credits
12.00

 China

Post time: 2020-12-20 15:30:01
| Show all posts
I don't know if the main reason is this effect:
#include <sstream>
#include <vector>
#include <string>
using namespace std;

void __fastcall TForm1::Button1Click(TObject *Sender)
{
stringstream inout("02 50 4B 31 30 32 43 42 44 41 42 34 42 41 42 42 41 41 32 30 32 30 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 42 33 46 35 33 39 33 36 42 43 42 36 32 30 32 30 32 30 32 30 32 30 32 30 39 38 33 30 32 37 30 31 33 33 33 30 34 32 30 31 33 38 38 30 33 37 30 31 33 35 38 30 33 34 30 31 33 34 38 30 33 33 30 31 32 34 33 30 33 33 30 31 30 33 39 30 33 32 30 31 32 33 33 30 33 32 30 31 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 4 6 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 03 2C 0D");
string s;
string result;
char *p;
while(inout>>s)
result.append(1,strtol(s.c_str(),&p,16));
Memo1->Text=result.c_str(); //ASCII string, a bunch of'F', hehe :)
}
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list