iconv

How do I link glibc's implementation of iconv?

六眼飞鱼酱① 提交于 2019-12-04 13:32:44
问题 The GNU C library provides an implementation of iconv - how do I use it? Simple program: #include <iconv.h> int main( int argc, char **argv ) { iconv_t cd = iconv_open( "UTF-8", "ISO-8859-1" ); iconv_close( cd ); return 0; } Compile and link: $ gcc -Wall iconv.c -o iconv /tmp/ccKAfXNg.o: In function `main': iconv.c:(.text+0x19): undefined reference to `libiconv_open' iconv.c:(.text+0x29): undefined reference to `libiconv_close' collect2: ld returned 1 exit status List the symbols to show they

Failed to build iconv gem on ruby 1.9.2

谁说胖子不能爱 提交于 2019-12-04 12:33:12
问题 I fail to install the 'iconv' gem, because of weird build errors. I have build the 'libiconv' from source and linked the .h and .dylib into the rvm's include and lib directory. When I run gem install iconv Gem outputs strange build errors: Building native extensions. This could take a while... ERROR: Error installing iconv: ERROR: Failed to build gem native extension. /Users/myusername/.rvm/rubies/ruby-1.9.2-rc2/bin/ruby extconf.rb checking for iconv() in iconv.h... no checking for iconv() in

Ruby Iconv works with irb and ruby debugger but not in a unit test

佐手、 提交于 2019-12-04 11:16:28
I'm running Ruby 1.8.7 with Rails 2.3.5 on Ubuntu 10.04 64-bit. I've written a method that should take a string like this, "École À la Découverte" and output a file-system name like this "ecole_a_la_decouverte" : (Iconv.new('US-ASCII//TRANSLIT', 'utf-8').iconv "École À la Découverte").downcase.split.join('_') When I test this line in my code, the test always fails saying that "cole_la_dcouverte" is unequal to "ecole_a_la_decouverte" . The odd thing is that if I insert a debugger line and use the debugger console the test passes. As well, running this line manually in irb and ./script/console

Change encoding multiple file with iconv in bash

℡╲_俬逩灬. 提交于 2019-12-04 09:24:09
I want to change multiple php files encoding with iconv. I use find and exec option (Reference : http://linux.bigresource.com/Ubuntu-Encoding-Conversion-on-Multiple-Files--4fuXvUwbN.html ) find . -type f -name '*.php' -print -exec iconv -f euc-kr -t utf-8 {} -o {}.utf8 But the error is occured. find: missing argument to `-exec' I just want to convert all php files in a once time. How can i do this with one statement in a bash? You must put either \; or + at the end of the -exec action. find . -type f -name '*.php' -print -exec iconv -f euc-kr -t utf-8 {} -o {}.utf8 \; klaun after some tests

Assigning Arabic text to R variables

你离开我真会死。 提交于 2019-12-04 05:50:50
R doesn't display correctly Arabic text. I get very weird stuff when I use Arabic. Here's a screenshot: The problem is that I want to create a wordcloud with Arabic text and I need to solve this problem first. R version: R 2.15.2 GUI 1.53 Leopard build 64-bit (6335) Here are more info: > options("encoding") $encoding [1] "native.enc" > Encoding("الله") [1] "unknown" SessionInfo(): > sessionInfo() R version 2.15.2 (2012-10-26) Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit) locale: [1] C/C/C/C/de_DE/C attached base packages: [1] stats graphics grDevices utils datasets methods base loaded via

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

☆樱花仙子☆ 提交于 2019-12-04 05:12:22
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. Mark Ransom I'm going to modify my code from another answer to implement the suggestion from Alf. std::string UTF8toISO8859_1(const char * in) { std::string out; if (in == NULL) return out; unsigned int codepoint; while (*in != 0) { unsigned

Building the latest iconv and libxml2 binaries in Win32

假装没事ソ 提交于 2019-12-04 04:03:50
I'm trying to get MinGW and MSYS working so I can build iconv and libxml2 in Windows, but I'm finding ./configure and make are giving lots of BSD/Unix related errors that aren't specific enough to google, and not descriptive enough for me to figure out. Can anybody go through some of the steps needed to get iconv and libxml2 .dll/.lib built on a Win32 machine? I'm updating the libraries for some software and I fiddled around with this all day today and haven't figured it out. I got the newest libpng, zlib and curl built with no issues but I see there isn't much support or how-to's for these

How to Convert UTF-16 to UTF-32 and Print the Resulting wchar_t in C?

耗尽温柔 提交于 2019-12-04 03:44:59
问题 i'm trying to print out a string of UTF-16 characters. i posted this question a while back and the advice given was to convert to UTF-32 using iconv and print it as a string of wchar_t. i've done some research, and managed to code the following: // *c is the pointer to the characters (UTF-16) i'm trying to print // sz is the size in bytes of the input i'm trying to print iconv_t icv; char in_buf[sz]; char* in; size_t in_sz; char out_buf[sz * 2]; char* out; size_t out_sz; icv = iconv_open("UTF

iconv or mbstring?

橙三吉。 提交于 2019-12-04 02:27:53
Which multibyte-handling library should I use : iconv or mbstring ? After some Googling I didn't find enough arguments to convince me to use one particularly, and I could not get any benchmark (and I'm too lazy do create one :-p). After all maybe this choice doesn't really matters ? Thanks for any piece of advice. I tend to use a combination of both - depending on my needs. I use iconv to convert from one charset to another, but mbstring for simpler operations like mb_strtoupper() and mb_stristr(). But if only one of the libraries is needed I suggest using mbstring purely for it's widespread

iconv - Detected an illegal character in input string

我们两清 提交于 2019-12-03 22:10:00
I don't see anything illegal - any suggestions on what might be the problem? if (strtolower($matches[1]) != 'utf-8') { var_dump($matches[1]); $xml = iconv($matches[1], 'utf-8', $xml); $xml = str_replace('encoding="'.$matches[1].'"', 'encoding="utf-8"', $xml); } Below is my debug/error string(12) "windows-1252" Notice (8): iconv() [http://php.net/function.iconv]: Detected an illegal character in input string [APP/models/sob_form.php, line 16] I've verified that the above code is indeed line 16 The illegal character is not in $matches[1] , but in $xml Try iconv($matches[1], 'utf-8//TRANSLIT',