iconv

convert jruby 1.8 string to windows encoding?

Hey, I want to export some data from my jruby on rails webapp to excel, so I create a csv string and send it as a download to the client using send_data(text, :filename => "file.csv", :type => "text/csv; charset=CP1252", :encoding => "CP1252") The file seems to be in UTF-8 which Excel cannot read correctly. I googled the problem and f...

Call iconv from Ruby through system()

I have a problem with iconv tool. I try to call it from rake file in that way: Dir.glob("*.txt") do |file| system("iconv -f UTF-8 -t 'ASCII//TRANSLIT' #{ file } >> ascii_#{ file }") end But one file is converted partly (size of partialy converted: 10059092 bytes, before convertion: 10081854). Comparing this two files prove that not ...

How to convert any possible format to UTF-8 using Iconv?

so for example this will turn 1251 into utf-8. $utf8 = iconv('windows-1251', 'utf-8', $ansi); But how to turn unknown (when it comes to us we do not know yet what format it is) ( in general any ) format (possibly known by Iconv ) to utf-8? (code sample) ...

libiconv - iconv_open() default behavior?

According to the documentation of iconv_open() over: http://www.gnu.org/software/libiconv/documentation/libiconv/iconv_open.3.html "//TRANSLIT" means that when a character cannot be represented in the target character set, it can be approximated through one or several characters. and: "//IGNORE" means that characters that cannot be re...

libiconv - iconv_open() default behavior?

According to the documentation of iconv_open() over: http://www.gnu.org/software/libiconv/documentation/libiconv/iconv_open.3.html "//TRANSLIT" means that when a character cannot be represented in the target character set, it can be approximated through one or several characters. and: "//IGNORE" means that characters that cannot be re...

How to use iconv in Qt?

I've installed qt-sdk-win-opensource-2010.03 and found an libiconv-2.dll in mingw part of qt distribution. How do I use it (I can't find iconv.h)? Is there a static version of iconv library? ...

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

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 m...

Can php convert strings with all charset encodes to utf8

Hi, Can php convert strings with all charset encodes to utf8? Solutions that don't works: utf8_encode($string) - but its only Encodes an ISO-8859-1 string to UTF-8? iconv($incharset, $outcharset,$text) - but how can be find string current encodding? (only can be if string part of html dom document, not just string) thanks ...

Auto iconv of Doctrine query

How do I set up Doctrine to automatically run iconv (Windows-1251 to Utf-8) when fetching data? ...

Building the latest iconv and libxml2 binaries in Win32

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 b...

PHP + iconv - Transform UTF-4 string?

I'm writing an E-Mail parser. I noticed that I received some emails that state their charset is UTF-4. However, when trying to convert these with iconv to UTF-8 it fails. Now my question is: I've never ever heard of UTF-4. Is this even a valid charset? And if not - can I just treat it as UTF-8? Here is part of the mail header: ["mime...

PHP DOM UTF-8 problem

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 edi...

iconv utf-8 to ascii transliteration in mod_php/apache2

I need to compare strings and match names to one another even if they are not spelled the same way. For example DÉSIRÉ-Smith should match Desireesmith as well as Desiree or Desi'ree Smith So i had the following approch which worked perfectly in the command line using PHP-CLI: <? class Alike { static function convertAlike...

Iconv is converting to UTF-16 instead of UTF-8 when invoked from powershell

I have a problem while trying to batch convert the encoding of some files from ISO-8859-1 to UTF-8 using iconv in a powershell script. I have this bat file, that works ok: for %%f in (*.txt) do ( echo %%f C:\"Program Files"\GnuWin32\bin\iconv.exe -f iso-8859-1 -t utf-8 %%f > %%f.UTF_8_MSDOS ) I need to convert all files on the d...

Failed to build iconv gem on ruby 1.9.2

Hello, 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:...

PHP function iconv character encoding from iso-8859-1 to utf-8

I'm trying to convert a string from iso-8859-1 to utf-8. But when I find these two charachter € and • the function returns a charachter that is a square with two number inside. How can I solve this issue? ...

PHP: Problems converting "’" character from ISO-8859-1 to UTF-8

I'm having some issues with using PHP to convert ISO-8859-1 database content to UTF-8. I am running the following code to test: // Connect to a latin1 charset database // and retrieve "Georgia O’Keeffe", which contains a "’" character $connection = mysql_connect('*****', '*****', '*****'); mysql_select_db('*****', $connection); mysql_s...

How to make iconv ignore the encoding errors?

Hi, I've a long text file with some invalidad encoded characters in UTF-16. So far, I've been trying to convert it using the following code: ic = Iconv.new( 'UTF-8//IGNORE', 'UTF-16' ) urf_8_str = ic.iconv( an_invalid_encoded_utf_16_string ) And I get an Iconv::InvalidCharacter exception. I'm using OS X 10.6 (since it seems that the...

php problem with russian language

i get page in utf-8 with russian language using curl. if i echo text it show good. then i use such code $dom = new domDocument; /*** load the html into the object ***/ @$dom->loadHTML($html); /*** discard white space ***/ $dom->preserveWhiteSpace = false; /*** the table by its tag name ***...

How to convert ISO-8859-1 to UTF-8 using libiconv in C++

I'm using libcurl to fetch some HTML pages. The HTML pages contain some character references like: &#1505;&#1500;&#1511;&#1493;&#1501; When I read this using libxml2 I'm getting: ׳₪׳¨׳˜׳ ׳¨ is it the ISO-8859-1 encoding? If so, how do I convert it to UTF-8 to get the correct word. Thanks EDIT: I got the solution, MSalters was right...