Bernd Burned wrote in post #968564:
> Hi everybody
>
> I'am working on a Rails app (using utf-8) in which I use the Spreadsheet
> gem to generate Excel files (.xls in my case).
>
> I ran into some issues when trying to write foreign characters to the
> generated Excel-File.
>
> The solution I found so far is to use Iconv like this:
> Iconv.conv('ISO-8859-9', 'utf-8', some_string)
>
> This works fine with for example turkish or spanish special characters.

That makes no sense.  If your data is already in UTF-8, then it 
shouldn't need to be converted.  It displays OK in your application?

(BTW, the concept of "special character" is really not a useful one. 
There are just characters.)


> However I cant figure out how to deal with japanese characters.

Again, no conversion should be necessary.

>
> My question is how do I have to use Iconv to encode the japanese
> characters so they will be correctly inserted into the Excel file.
>
> Also I would be interested in some background info on this problem (
> namely generating office files and utf-8 ) since I honestly don't really
> understand the whole issue Excel seems to have there.
>
> Thanks in advance for any kind of  help and advice.
>
> jruby 1.5.0
> rails 2.3.8
> spreadsheet 0.6.4.1

My advice is to take a different approach altogether.  Microsoft Office 
documents generally do not play well with Web browsers, so IMHO they 
have no place in Web applications at all.  I would suggest exporting the 
data in another format, such as CSV or PDF.  If you can say more about 
what you're using the Excel files for, I'll be happy to offer 
alternative suggestions.

However, even if you do need an Excel file, it may be worth generating 
it as HTML.  It turns out that Excel supports a representation of its 
spreadsheets as extended HTML -- see 
http://www.c-sharpcorner.com/UploadFile/kaushikborah28/79Nick08302007171404PM/79Nick.aspx
 
-- and this will probably be easier to have Rails generate correctly.

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
[email protected]

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to