我们在web应用开发过程中经常遇到输出某种编码的字符,如iso8859-1等,如何输出一个某种编码的字符串?
In web development, we often deal with outputting strings in a specific encoding (e.g., ISO-8859-1). How do you output a string in a specific encoding?
题目类型: 技术面试题
这是一道技术面试题,常见于澳洲IT公司面试中。
难度: medium
分类: Web, Java
标签: Encoding, ISO-8859-1, GBK
参考答案摘要
答案 Public String translate (String str) { String tempStr = ""; try { tempStr = new String(str.getBytes("ISO-8859-1"), "GBK"); tempStr = tempStr.trim(); } catch (Exception e) { System.err.println(e.get...
本题提供 STAR 原则详细解答和技术解析,登录匠人学院学习中心即可查看完整答案。