create account

RE: 温故而知新:复习一下字符编码(ASCII、GB2312、Unicode、UTF-8、区位码) by coder-bts

View this thread on: hive.blogpeakd.comecency.com

Viewing a response to: @oflyhigh/ascii-gb2312-unicode-utf-8

· @coder-bts ·
$0.30
说到 ASCII 我就想到一件让我来气的事,很好笑:

我以前有一个程式中需要识别几个按键,那个程序是纯 C 写的(C99),然后一开始在 Linux 下写,用 getch() 来获取键,然后写了个宏来判断操作系统,来适配 win;结果 Linux 方向键和 win 下的方向键的 ascii 值不一样,win 下测试不通过,当时已经 release 了。马上开始修,结果测试出来,按两下同一个方向键,在 win 下返回的 ascii 值居然不同?

后来才发现,win 下面功能键都会先返回一个 ascii 值(好像是 31,不记得了),告诉你:接下来这个键是功能键!然后再返回真实键值。调试了许久。
👍  
properties (23)
authorcoder-bts
permlinkre-oflyhigh-ascii-gb2312-unicode-utf-8-20180428t142526092z
categoryencoding
json_metadata{"tags":["encoding"],"community":"busy","app":"busy/2.4.0"}
created2018-04-28 14:25:27
last_update2018-04-28 14:25:27
depth1
children2
last_payout2018-05-05 14:25:27
cashout_time1969-12-31 23:59:59
total_payout_value0.224 HBD
curator_payout_value0.071 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length301
author_reputation2,427,587,640,530
root_title温故而知新:复习一下字符编码(ASCII、GB2312、Unicode、UTF-8、区位码)
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id52,652,575
net_rshares46,491,357,560
author_curate_reward""
vote details (1)
@oflyhigh ·
识别按键,一看就是要做坏事
properties (22)
authoroflyhigh
permlinkre-coder-bts-re-oflyhigh-ascii-gb2312-unicode-utf-8-20180429t004800792z
categoryencoding
json_metadata{"tags":["encoding"],"app":"steemit/0.1"}
created2018-04-29 00:48:03
last_update2018-04-29 00:48:03
depth2
children1
last_payout2018-05-06 00:48:03
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length13
author_reputation6,269,738,073,419,739
root_title温故而知新:复习一下字符编码(ASCII、GB2312、Unicode、UTF-8、区位码)
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id52,733,211
net_rshares0
@coder-bts ·
没有没有,就方向键识别需求
properties (22)
authorcoder-bts
permlinkre-oflyhigh-re-coder-bts-re-oflyhigh-ascii-gb2312-unicode-utf-8-20180429t032537316z
categoryencoding
json_metadata{"tags":["encoding"],"community":"busy","app":"busy/2.4.0"}
created2018-04-29 03:25:36
last_update2018-04-29 03:25:36
depth3
children0
last_payout2018-05-06 03:25:36
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length13
author_reputation2,427,587,640,530
root_title温故而知新:复习一下字符编码(ASCII、GB2312、Unicode、UTF-8、区位码)
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id52,751,178
net_rshares0