Topic: 一道机试题,大家自己做一下 |
Print this page |
1.一道机试题,大家自己做一下 | Copy to clipboard |
Posted by: liyan811101 Posted on: 2007-08-22 19:57 将一个ISO-8859-1编码的字符串转换为GBK编码 类似这类问题公司很爱考 |
2.Re:一道机试题,大家自己做一下 [Re: liyan811101] | Copy to clipboard |
Posted by: JiafanZhou Posted on: 2007-08-22 22:30 Using bash shell and using Linux - of course ! iconv --from-code=ISO-8859-1 --to-code=GBK ./oldfile > ./newfile PS. I am not familiar with the algorithm used here to convert the characters, so if anybody provides one here, will discuss about it. you see, engineers are lazy sometimes. |
3.Re:一道机试题,大家自己做一下 [Re: liyan811101] | Copy to clipboard |
Posted by: menzy Posted on: 2007-08-27 14:16 java 开发过程中一般用String类 |
4.Re:一道机试题,大家自己做一下 [Re: menzy] | Copy to clipboard |
Posted by: Cappuccino Posted on: 2007-08-28 03:39 menzy wrote: 应该不是指这个吧。 如果是指内码转换的话,估计是要自己如一楼所说的自己翻翻内码的算法。如果只是把iso编码的gbk字符decode回来的话直接new String(isostr.getBytes("iso-8859-1"),"gbk")就ok |
5.Re:一道机试题,大家自己做一下 [Re: Cappuccino] | Copy to clipboard |
Posted by: JiafanZhou Posted on: 2007-08-28 17:52 Cappuccino wrote: 其实我还不知道可以用String来转化编码,谢拉。 |
6.Re:一道机试题,大家自己做一下 [Re: liyan811101] | Copy to clipboard |
Posted by: andy_wang_5 Posted on: 2007-08-29 11:46 不是在考你算法,而是在看你的知识面。初学者不会知道String有这种用法的 |
7.Re:一道机试题,大家自己做一下 [Re: liyan811101] | Copy to clipboard |
Posted by: liyan811101 Posted on: 2007-08-29 19:02 呵呵,没错,是用getBytes这个方法。 |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |