惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
T
Threatpost
Latest news
Latest news
N
News | PayPal Newsroom
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Help Net Security
Help Net Security
D
Darknet – Hacking Tools, Hacker News & Cyber Security
AI
AI
Simon Willison's Weblog
Simon Willison's Weblog
TaoSecurity Blog
TaoSecurity Blog
The Last Watchdog
The Last Watchdog
L
LINUX DO - 热门话题
Google DeepMind News
Google DeepMind News
T
Threat Research - Cisco Blogs
O
OpenAI News
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
T
The Exploit Database - CXSecurity.com
NISL@THU
NISL@THU
Application and Cybersecurity Blog
Application and Cybersecurity Blog
S
Securelist
小众软件
小众软件
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Martin Fowler
Martin Fowler
S
SegmentFault 最新的问题
Cisco Talos Blog
Cisco Talos Blog
云风的 BLOG
云风的 BLOG
AWS News Blog
AWS News Blog
GbyAI
GbyAI
N
News and Events Feed by Topic
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
美团技术团队
Engineering at Meta
Engineering at Meta
A
About on SuperTechFans
博客园 - 三生石上(FineUI控件)
S
Schneier on Security
博客园 - 聂微东
V2EX - 技术
V2EX - 技术
T
Troy Hunt's Blog
SecWiki News
SecWiki News
S
Secure Thoughts
B
Blog RSS Feed
Hugging Face - Blog
Hugging Face - Blog
WordPress大学
WordPress大学
腾讯CDC
H
Heimdal Security Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Apple Machine Learning Research
Apple Machine Learning Research
月光博客
月光博客
www.infosecurity-magazine.com
www.infosecurity-magazine.com
P
Privacy International News Feed

博客园 - Render

数据绑定表达与javascript字符串连用 - Render - 博客园 手工删除打印任务 burrow在某些项目使用中报"控件包含代码块(即 <% ... %>),因此无法修改控件集合" - Render httpModules remove does not work in a folder or virtual directory 事件触发型ActiveX放置在网页中的部分思考 Arc Catalog重建索引时报错:ORA-02298: 无法验证 (SDE.A18_FK1) - 未找到父项关键字 (A18_FK1) 指定web.config让httphandler处理某目录及子目录下所有文件 - Render - 博客园 windows命令行里取得年-月-日-时-分-秒的办法 - Render - 博客园 网站复杂信息自动录入处理 css中url的路径含义 ORACLE Transparent Gateway透明网关安装配置小问题 使用OLEDB访问ACCESS的几点经验 ARCIMS Serverlet Connector查询属性,当属性为中文时乱码处理 - Render [转载]ARCIMS 9.2 [ERR0134]错误解决方法 ORACLE 大数据表Update处理 PL/SQL developer的HomeEnd问题(转载) ArcSDE9.0对Oracle初始化参数的要求 在SDE中创建dataset时"Fail to Create, Cann't found spatial referrence entry"错 处理Oralce中非法的日期值
Javascript中文字符串处理额外注意事项 - Render - 博客园
Render · 2009-11-14 · via 博客园 - Render

javascript文件中的字符常量与所在的js文件字符编码密切相关,如下一段代码:

var strSex="男" ;

在GB2312编码中,假设有另一变量strAxSex是从ActiveX控件中读出的BSTR值,原始值也是"男" ,这时做在javascript程序中做比较:strSex==strAxSex为false,也就是"男"!="男"。

但如果从VS2005调试中看表达式 strSex==strAxSex则为true,细看strSex.charCodeAt(0)与strAxSex.charCodeAt(0)也是相等的,而strSex.charCodeAt(0)与strAxSex.charCodeAt(0)也相等都为NaN。

再注意看vs2005变量值提示,可以看到strSex="□□“。原来是字符常量非unicode,导致strSex所赋值不同于"男"的unicode值。尝试把js文件另存为编码utf-8,再次运行,终于 strSex==strAxSex为true,程序运行与调试器表现一致,和日常逻辑也一致了。