问题描述
我正在 React Native 中实现移动应用程序,该应用程序需要使用特定语言(捷克语)的字符集。首先,我在 xmlhttprequest 中调用此页面以下载所有使用 WINDOWS-1250 编码 (http://www.cbdx.cz/denikcl6/add/denikcl6.tom) 编码的纯文本数据。正如我意识到 xmlhttrequest 作为默认值将此文本转换为 UTF-8 。现在我尝试使用 iconv-lite 将此 UTF-8 转换后的文本转换回 WINDOWS-1250,但它看起来不起作用。这是我的代码:
var request = new XMLHttpRequest();
request.open("GET",url,true);
request.send(null);
request.onreadystatechange = function () {
if (request.readyState === 4 && request.status === 200) {
var type = request.getResponseHeader("Content-Type");
if (type.indexOf("text") !== 1) {
setDownText(
iconv
.decode(Buffer.from(request.response),"windows-1250")
.substring(0,100)
);
console.log(downText);
}
}
有什么方法可以实现我的目标,使其具有与此完全相同的文本?这是我的预期输出与真实输出。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)