Patches: Browse | Submit New | Admin

[#17479] Character encoding conversion with $KCODE

Date:
2008-01-25 07:49
Priority:
3
Submitted By:
Norihito YAMAKAWA (yamakawap)
Assigned To:
Nobody (None)
Category:
None
State:
Open
Summary:
Character encoding conversion with $KCODE

Detailed description
Some UTF-8 or other Japanese mails with ActionMailer are broken with NKF's auto characterset detection.
This patch give NKF explicit input encoding with $KCODE on mail subject and mail body.
Additionaly, patch allows NKF to pass extra options such as '--no-cp932'.

class Notifier < ActionMailer::Base
  self.nkf_options = '-h1 --no-cp932'
end

This may be useful for more flexible character encodings conversion.

Add A Comment: Notepad

Please login


Followup

Message
Date: 2008-01-28 16:50
Sender: Masao Mutoh

I think it's better to set the input encoding with
GetText.output_charset, not $KCODE.
Basically, the charset of the message body is same as the current
charset for output(you can get it from GetText.output_charset).

On the other hand, the most important issue is to use NKF.
Because it's only for Japanese, and don't work under JRuby.

I need to consider again what implementation is good. 

Thanks.
Date: 2008-01-28 02:04
Sender: Norihito YAMAKAWA

Sorry, here's !

It is seems to require '--no-cp932' option for NKF when
convert texts involving JIS extend characters such as
'0x8740~0x879E', '0xED9F~0xEDFC', extra. So that I made this
patch.

JIS extend characters are described as below.
http://homepage1.nifty.com/~petronius/kana/kakutyaumozi.html
Date: 2008-01-26 17:24
Sender: Masao Mutoh

Where is your patch?

Attached Files:

Name Description Download
rails_with_kcode.diff Download

Changes:

Field Old Value Date By
File Added3264: rails_with_kcode.diff2008-01-28 02:04yamakawap