所以例如这将把1251变成utf-8.
$utf8 = iconv('windows-1251', 'utf-8', $ansi);
Run Code Online (Sandbox Code Playgroud)
但是如何将未知(当涉及到我们时,我们还不知道它是什么格式)(通常是任何)格式(可能是由Iconv知道)到utf-8?(代码示例)
当我试图音译西里尔语utf-8字符串时
Iconv.iconv('ascii//ignore//translit', 'utf-8', string).to_s
Run Code Online (Sandbox Code Playgroud)
(参见问题/ 1726404/transliteration-in-ruby)
除了那些必须被音译的符号外,我得到了所有东西.
例如:'r-строка'→'r-'和'Gévry'→'Gvry'.
怎么了?
Ruby 1.8.7/Rails 2.3.5/WSeven
我试图获取一个包含字符串的JSON块,\u009e我希望将这些字符转换为其关联的单个unicode字符,在本例中é.
我使用curl或wget下载json,它看起来像:
{ "name": "Kitsun\u00e9" }
Run Code Online (Sandbox Code Playgroud)
并且需要在Vim中将其翻译为:
{ "name": "Kitsuné" }
Run Code Online (Sandbox Code Playgroud)
我的第一个想法是使用Vim的iconv,但它不会将字符串作为单个字符进行评估,只返回输入.
let code = '\u00e9'
echo iconv(code, "UTF-8", "UTF-8")
" Prints \u00e9
Run Code Online (Sandbox Code Playgroud)
我想最终使用类似的东西
%s;\\u[0-9abcdef]*;\=iconv(submatch(0),"UTF-8", "UTF-8");g
Run Code Online (Sandbox Code Playgroud) 我正在尝试将UTF-8 string转换为ISO-8859-1 char*以用于遗留代码.我看到这样做的唯一方法是iconv.
我肯定更喜欢完全string基于C++的解决方案,然后只需调用.c_str()生成的字符串.
我该怎么做呢?请尽可能使用代码示例.iconv如果它是你知道的唯一解决方案,我很好用.
我正在尝试在OpenShift上部署名为Jingo的Node.js Wiki :
Error: Cannot find module '../build/Debug/iconv.node'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/var/lib/openshift/550a72cf5973cac5c10000ca/app-root/runtime/repo/node_modules/icon
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
DEBUG: Program node jingo -c config.yaml exited with code 8
Run Code Online (Sandbox Code Playgroud)
我已尝试在命令行运行node-gyp configure和node-gyp build,但我没有足够的权限.我也尝试在package.json文件中包含node-gyp configure和node-gyp build作为安装脚本但是得到以下错误:
remote: > node-gyp configure; node-gyp build
remote:
remote: gyp info it worked if it ends with ok
remote: gyp info using node-gyp@0.12.2
remote: gyp info …Run Code Online (Sandbox Code Playgroud) 我试图通过使用iconv从unknown-8bit转换为us-ascii.我有
$ iconv -f unknown-8bit -t us-ascii file.txt > file1.txt
它显示一条错误消息.
iconv: conversion from `unknown-8bit' is not supported
Try `iconv --help' or `iconv --usage' for more information.
Run Code Online (Sandbox Code Playgroud)
是否有替代方案进行转换?谢谢!!
我正在尝试使用该iconv函数将字符串从UTF-8转换为ASCII 8位.该字符串旨在导入会计软件(根据SIE标准解析一些基本指令).
我现在正在运行的:
iconv("UTF-8", "ASCII", $this->_output)
Run Code Online (Sandbox Code Playgroud)
这适用于会计软件#1,但软件#2抱怨编码.标准规定的编码是:IBM PC 8-bit extended ASCII (Codepage 437).
我的问题是,什么版本的ASCII是PHP编码我的字符串,如果不是指定的 - 我如何编码字符串相应的标准规范?
我在将以下文件导入时遇到问题:http://www.kuleuven.be/bio/ento/temp/test.xlsx 以正确的编码方式导入 到R中.特别是,
library("xlsx")
read.xlsx("test.xlsx",1,header=F,colClasses=c("character"),encoding="UTF-8")
Run Code Online (Sandbox Code Playgroud)
给我
X1
1 a-cadinol
2 a-calacorene
3 a-caryophyllene alcohol
4 a-curcumene
5 a-elemol
6 a-muurolene
7 a-terpineol acetate
8 ß-4-dimethyl-3-cyclohexane-1-ethanol acetate
9 ß-bisabolene
10 ß-bisabolol
11 ß-bourbonene
12 ß-caryophyllene alcohol
13 ß-cyclocitral
14 ß-farnesol
15 ß-selinene
16 ß-sesquiphellandrene
17 <U+03B3>-cadinene
18 <U+03B3>-Carboethoxy-<U+03B3>-butyrolactone
19 <U+03B3>-ethyl-<U+03B3>-butyrolactone
20 <U+03B3>-eudesmol
21 <U+03B3>-muurolene
22 <U+03B3>-nonalactone
23 <U+03B3>-octalactone
24 <U+03B3>-selinene
25 <U+03B3>-undecalactone
26 d-cadinene
27 d-cadinol
28 d-muurolene
29 d-undecalactone
Run Code Online (Sandbox Code Playgroud)
但是a-,<U+03B3>-和d-应alpha- …
我在 Symfony 上收到此错误:
尝试从全局命名空间调用函数“iconv”。
我从这里得到了取消文件中“extension = iconv”注释的答案/etc/php/php.ini。但iconv本身并没有安装。我已经安装了libiconv和libticonv软件包,但它仍然无法工作。
我在 Manjaro 上。
或者这两个字符根本不存在于 Shift_JIS 中?
\nShift_JIS 字符编码方案中的前 128 个字符与 ASCII 匹配,但有两个字符除外:0x5C 是日元符号 ( \xc2\xa5) 而不是反斜杠,0x7E 是上划线 ( \xe2\x80\xbe) 而不是波形符。
虽然有大量关于如何接管 和 的明确信息\xc2\xa5,\xe2\x80\xbe但\\我~无法找到任何关于 Shift_JIS 中是否存在\\和 的明确声明~,或者是否存在替代(可能是多字节) ) 编码来处理这两个移位的 ASCII 字符。
当我尝试编码\\或~使用node-iconv时,它会抛出错误。
iconv-lite\xc2\xa5将和编码\\为 0x5C,将 和 编码\xe2\x80\xbe为~0x7E。解码时, iconv-lite 目前(不幸的是)将 0x5C 解码为\\0x7E ~,等待对错误报告的响应: