Encoding sentences for a mail title

Top Japanese page




Overview

MIME encode mail header so that Japanese characters correctly displayed. This method can be used for mail subject and address where Japanese is used.

Flow

  1. Load Jcode
  2. Do a MIME encode

A sample code

 use Jcode;
 
 my $string = "日本語文字列";
 
 my $encoded_string = jcode($string)->mime_encode;

Description of the code

 use Jcode;

Load Jcode.

 my $string = "日本語文字列";

$string containts Japanese characters. Obtain the code of this Japanese characters.

 my $encoded_string = jcode($string)->mime_encode;

Perform a MIME encode using mime_encode method of Jcode. This allows to include Japanese characters into mail header without breaking Japanese characters.

Performing MIME encode of ``日本語文字列'' results the following output.

 =?ISO-2022-JP?B?GyRCRnxLXDhsSjg7ek5zGyhC?=