Recently, someone accidentally asked this question about character encoding, So Baidu made a simple analysis by referring to the two documents.
**************************************** ******************************
Reference material 1: http://zhidao.baidu.com/link? Url = YDoT2OLdKEElDQ86Ce_wEtKt9Nrn2yJ8TIb9JkasvaLvi8D66RRwSvxn2DkFRVM_OOnq4fCoJPA-19AmpPeypa
? "206 210 176 174 214 236 187 219" is an ASCLL code. What is the edited Chinese Character ???
Submitted:
Very speechless... We are very professional .. Meaning "I love Zhu Hui"
**************************************** ****************
Start analysis now:
MATERIALS:
"206 210 176 174 214 236 187 219" is an ASCLL code. The edited Chinese version is "I love Zhu Hui ".
Write code:
#include<stdio.h>int main(void){ printf("%c%c%c%c%c%c%c%c",206,210,176,174,214,236,187,219); printf("\n"); return 0;}
Running result:
You can see it here.
The Chinese character is a double byte, and two digits can encode one Chinese character.
Summary:
206 + 210 = me
176 + 174 = love
214 + 236 = Zhu
187 + 219 = Hui
Well, there is no need to go further here.
However, in a whim, I want to find out which two numbers can be used to combine the word "you?
I want to code "I love you! Hey.
So I did a lot of tests. No way. If you don't understand this, you have to use loops.
Write the following code.
The test found that 129 to 247 are encoded Chinese characters, and the remaining range cannot be encoded into Chinese characters.
Test code 1:
#include<stdio.h>
int main(void)
{
int i;
for(i=129;i<=247;i++)
printf("%d+%d=%c%c\t",i,i,i,i);
printf("\n");
return 0;
}
Running result:
Test code 2:
#include<stdio.h>int main(void){ int i; for(i=129;i<=247;i++) printf("%d+%d=%c%c\t",i,i+1,i,i+1); printf("\n"); return 0;}
Running result:
Test code 3:
#include<stdio.h>int main(void){ int i; for(i=129;i<=247;i++) printf("%d+%d=%c%c\t",i,i+2,i,i+2); printf("\n"); return 0;}
......
And so on, after testing several sets of code, we can summarize the following:
206 + 210 = me 176 + 174 = love 184 + 184 = parent 208 + 208 = rows 193 + 193 = bright 183 + 183 = vendors 198 + 198 = broken 131 + 131 = silly 188 + 188 = Technology 177 + 177 = North 180 + 180 = create 181 + 181 = files 182 + 182 = shake 185 + 185 = Structure 186 + 186 = Han 187 + 187 = change 191 + 191 = depends 196 + 196 = 195 + 195 = sister 202 + 202 = Applicable 197 + 197 = rows 200 + 200 = hot 214 + 214 = types 199 + 199 = Joe 213 + 213 = photo 199 + 199 = Joe |
204 + 204 = hot 192 + 192 = Overview 180 + 181 = blow 181 + 182 = knife 176 + 177 = ammonia 204 + 205 = Tao 206 + 207 = Worm 192 + 193 = lazy 187 + 188 = affected 182 + 183 = fighting 185 + 186 = purchase 190 + 191 = Research 191 + 192 = average 197 + 198 = card 180 + 181 = blow 183 + 184 = criminal 193 + 194 = sorry 194 + 195 = Travel 198 + 199 = amber 199 + 200 = overseas Chinese 203 + 204 = song 206 + 207 = Worm 207 + 208 = idle 208 + 209 = awake 209 + 210 = rock 176 + 178 = Security |
177 + 179 = back 178 + 180 = boat 179 + 181 = car 180 + 182 = cooking 183 + 185 = rice 184 + 186 = negative 185 + 187 = enough 186 + 188 = Hangzhou 187 + 189 = call 188 + 190 = quarter 190 + 192 = correction 195 + 197 = door 198 + 200 = forced 199 + 201 = coincidence 200 + 202 = kernels 201 + 203 = Injury 203 + 205 = Send 204 + 206 = Tao 205 + 207 = drag 208 + 210 = lucky 210 + 212 = 211 + 213 = lure 212 + 214 = disaster recovery 213 + 215 = MB 214 + 216 = heavy 215 + 217 = Tracing |
176 + 179 = me 177 + 180 = Bay 178 + 181 = barge 181 + 184 = average 182 + 185 = beans 183 + 186 = generic 184 + 187 = rich 185 + 188 = average 186 + 189 = airline 193 + 196 = chat 194 + 197 = repeated 195 + 198 = stuffy 196 + 199 = that 200 + 203 = Persons 201 + 204 = vendors 202 + 205 = release 203 + 206 = song 209 + 212 = words 210 + 213 = Yi 211 + 214 = again 212 + 215 = slaughter 217 + 220 = more 176 + 180 = Press 178 + 182 = capture 179 + 183 = withdrawal 181 + 185 = inverted |
182 + 186 = funny 188 + 192 = sacrifice 195 + 199 = 197 + 201 = School 200 + 204 = tolerance 201 + 205 = rewards 202 + 206 = Decoration 212 + 216 = Load 213 + 217 = Zhao 214 + 218 = Public 177 + 182 = times 181 + 186 = Island 183 + 188 = Fang 214 + 219 = boat 215 + 220 = Total 212 + 217 = repeat 210 + 215 = easy 208 + 213 = surname 207 + 212 = display 190 + 185 = long 176 + 182 = Bank 180 + 186 = spring 182 + 188 = both 183 + 189 = Fang 200 + 206 = Ren 201 + 207 = above |
I haven't found you for half a day. I'm so tired.
Baidu again to see if there are any other convenient methods.
After searching for half a day, I finally found document 2.
**************************************** *************************************
Reference 2: http://zhidao.baidu.com/link? Url = TyO1WecgunJH_ZOeeSqX1o8O8QPxga2B7JsMrQRzWajNs7O8Nh-g-Yr3B-zzAV1vO_vDqcn6qNDVqj8DwHDH2q
Question:
The two ASCLL codes in C can represent Chinese characters (for example, 202,214 represents hands). How does the two ASCLL correspond to the location codes in GB2312?
"Ah" is the first of the country standard codes, which is 1601. How to express it with the ASCLL code?
Answer:
# Include <stdio. h> int main (void ){
Char s [] = "ah"; // Chinese characters are expressed in two bytes in C/C ++, and the corresponding ASCII code is two negative numbers. Char m [3]; printf ("% d \ n", s [0], s [1]);/* Comment s [0] =-80, s [1] =-95 comment */m [0] =-80; m [1] =-95; m [2] = 0; puts (m ); // concatenate two bytes into one Chinese character .}
Running result:
**************************************** **************************************** *************************
So I imitated document 2 and found out the encoding of the Chinese character "you.
Write the following code:
# Include <stdio. h> int main (void) {char s [] = "you"; // Chinese characters are expressed in 2 bytes in C/C ++, the corresponding ASCII code is two negative numbers. Char m [3]; printf ("% d \ n", s [0], s [1]); m [0] =-60; m [1] =-29; m [2] = 0; puts (m); // two bytes are connected to form a Chinese character. Return 0 ;}
Running result:
Modify the Code:
# Include <stdio. h> int main (void) {char s [] = "you"; // Chinese characters are expressed in 2 bytes in C/C ++, the corresponding ASCII code is two negative numbers. Char m [3]; printf ("% c \ n", s [0], s [1]); m [0] =-60; m [1] =-29; m [2] = 0; puts (m); // two bytes are connected to form a Chinese character. Return 0 ;}
Running result:
Okay, you're done! Haha, I finally got it.
Final code improvement:
#include<stdio.h>int main(){ int i; printf("%c%c%c%c%c%c\n",206,210,176,174,-60,-29); return 0;}
Running result:
Haha, okay. Finish the work. Prepare for sleep.