iconv

in `require': no such file to load — iconv (LoadError)

拜拜、爱过 提交于 2019-12-17 16:32:36
问题 ➜ expertiza git:(master) ✗ ruby -v ruby 1.8.7 (2011-06-30 patchlevel 352) [i686-darwin11.1.0] ➜ expertiza git:(master) ✗ rails -v Rails 2.3.14 ➜ expertiza git:(master) ✗ script/server /Users/HPV/.rvm/gems/ruby-1.8.7-p352/gems/activesupport-2.3.14/lib/active_support/inflector.rb:3:in `require': no such file to load -- iconv (LoadError) from /Users/HPV/.rvm/gems/ruby-1.8.7-p352/gems/activesupport-2.3.14/lib/active_support/inflector.rb:3 from /Users/HPV/.rvm/gems/ruby-1.8.7-p352/gems

Convert string from UTF-8 to ISO-8859-1

血红的双手。 提交于 2019-12-14 03:41:51
问题 I'm trying to convert a UTF-8 string to a ISO-8859-1 char* for use in legacy code. The only way I'm seeing to do this is with iconv. I would definitely prefer a completely string -based C++ solution then just call .c_str() on the resulting string. How do I do this? Code example if possible, please. I'm fine using iconv if it is the only solution you know. 回答1: I'm going to modify my code from another answer to implement the suggestion from Alf. std::string UTF8toISO8859_1(const char * in) {

PHP DOM UTF-8 problem

家住魔仙堡 提交于 2019-12-13 16:47:18
问题 First of all, my database uses Windows-1250 as native charset. I am outputting the data as UTF-8. I'm using iconv() function all over my website to convert Windows-1250 strings to UTF-8 strings and it works perfect. The problem is when I'm using PHP DOM to parse some HTML stored in the database (the HTML is an output from a WYSIWYG editor and is not valid, it has no html, head, body tags etc). The HTML could look something like this, for example: <p>Hello</p> Here is a method I use to parse a

iconv encoding conversion problem

萝らか妹 提交于 2019-12-13 12:23:14
问题 I am having trouble converting strings from utf8 to gb2312. My convert function is below void convert(const char *from_charset,const char *to_charset, char *inptr, char *outptr) { size_t inleft = strlen(inptr); size_t outleft = inleft; iconv_t cd; /* conversion descriptor */ if ((cd = iconv_open(to_charset, from_charset)) == (iconv_t)(-1)) { fprintf(stderr, "Cannot open converter from %s to %s\n", from_charset, to_charset); exit(8); } /* return code of iconv() */ int rc = iconv(cd, &inptr,

iconv library on Mac OS X: strange behavior

你离开我真会死。 提交于 2019-12-13 05:48:58
问题 I am porting application from CentOS 6 to Mac OS X. It depends on iconv and works in CentOS normally. However, on Mac OS X it doesn't. I see following behavior: const char *codePages[] = { "MAC", "LATIN1", "ISO_8859-1", "WINDOWS-1252", "ASCII" }; int codePagesCount = 5; iconv_t converter1 = iconv_open("UTF-32", codePages[0]);// Works if(converter1 != (iconv_t)-1) iconv_close(converter1); iconv_t converter2 = iconv_open("UTF−32", "MAC");// Fails, returns -1 if(converter2 != (iconv_t)-1) iconv

Building libiconv fails with the Android standalone toolchain

試著忘記壹切 提交于 2019-12-12 21:16:03
问题 When I try to build libiconv using the Android NDK standalone toolchain (android-ndk-r5-crystax-2), I get this error output. Can someone please tell me what might be wrong? My environment looks like this: export NDK=$HOME/android/android-ndk-r5-crystax-2 export TOOLCHAIN=$HOME/android/toolchain export ARCH=armv7-a export SYSROOT=$TOOLCHAIN/sysroot export PATH=$PATH:$TOOLCHAIN/bin:$SYSROOT/usr/local/bin export CROSS_COMPILE=arm-linux-androideabi export CC=${CROSS_COMPILE}-gcc export CXX=$

Iconv: EILSEQ with ASCII//IGNORE but not with ASCII//TRANSLIT//IGNORE

与世无争的帅哥 提交于 2019-12-12 12:15:00
问题 Using iconv with //TRANSLIT//IGNORE to convert from utf8 to ascii works fine; it replaces the non-convertible characters to a proper transliteration according to the current locale (de_DE in my case): > echo 'möp' | iconv -f 'UTF8' -t 'ASCII//TRANSLIT//IGNORE' moep However, when just using //IGNORE without //TRANSLIT , it throws an error: > echo 'möp' | iconv -f 'UTF8' -t 'ASCII//IGNORE' mp iconv: illegal input sequence at position 5 I wonder why that happens. The input sequence is exactly

How can I convert Cyrillic stored as LATIN1 ( sql ) to true UTF8 Cyrillic with iconv?

让人想犯罪 __ 提交于 2019-12-12 08:13:54
问题 I have a SQL dump file consisting of incorrectly stored Cyrillic Russian ( WINDOWS-1251 ) text, example Èðàíñêèå which should properly be displayed as Иранские . In the past I have successfully converted the sql file but memory fails in what I did and in what order. Logically it would make sense that since it's stored in LATIN1 I would convert from LATIN1 to WINDOWS-1251 and then from WINDOWS-1251 to UTF-8//TRANSLIT or something like that. So far I've tried: 1. iconv -f WINDOWS-1251 -t UTF-8/

Cannot convert � to readable string with iconv

假装没事ソ 提交于 2019-12-11 19:09:21
问题 I have a large text file with a iso-8859-1 encoding which I obtain from: file -i file.txt When I cat a file to see the data, there will be a �� instead of a Thai string. At first, I think that I can just use iconv in linux to convert the encoding format to other type which I found iso-8859-11 format that can read Thai string and think that it will work. Something like this: iconv -f iso-8859-1 -t iso-8859-11 file.txt > output.txt But instead, I got this error: iconv: illegal input sequence at

iconv() – how to detect offending character?

我只是一个虾纸丫 提交于 2019-12-11 15:21:54
问题 I use iconv() to convert CSV data from UTF-8 to Windows-1252 . $converted = iconv("UTF-8", "Windows-1252", $csvData); In some cases, iconv() failed quietly, returning false . I also tried using //TRANSLIT but `iconv()´ returns false here as well. When i add the //IGNORE statement to the target charset, the conversion succeeds, but that means one or more character(s) got lost. I can stick to //IGNORE but i would like to find out which character(s) are causing the problem. How can i do this?