| java.lang.Object org.bulbul.webmail.util.TranscodeUtil
TranscodeUtil | public class TranscodeUtil (Code) | | TranscodeUtil.
Provides transcoding utilities.
author: Steve Excellent Lee. version: 1.0 2000 |
Method Summary | |
public static String | transcodeThenEncodeByLocale(String sourceString, String sourceStringEncoding, Locale locale) Why we need
org.bulbul.util.TranscodeUtil.transcodeThenEncodeByLocale()?
Because we specify client browser's encoding to UTF-8, IE seems
to send all data encoded in UTF-8. |
transcodeThenEncodeByLocale | public static String transcodeThenEncodeByLocale(String sourceString, String sourceStringEncoding, Locale locale) throws java.io.UnsupportedEncodingException(Code) | | Why we need
org.bulbul.util.TranscodeUtil.transcodeThenEncodeByLocale()?
Because we specify client browser's encoding to UTF-8, IE seems
to send all data encoded in UTF-8. That means the byte sequences
we received are all UTF-8 bytes. However, strings read from HTTP
is ISO8859_1 encoded, that's we need to transcode them (usually
from ISO8859_1 to UTF-8.
Next we encode those strings using MimeUtility.encodeText() depending
on user's locale. Since MimeUtility.encodeText() is used to convert
the strings into its transmission format, finally we can use the
strings in the outgoing e-mail, then receiver's email agent is
responsible for decoding the strings.
As described in JavaMail document, MimeUtility.encodeText() conforms
to RFC2047 and as a result, we'll get strings like "=?Big5?B......".
Parameters: sourceString - String to be encoded Parameters: sourceStringEncoding - The encoding to decode `sourceString' string. If `sourceStringEncoding'is null, use JVM's default enconding. Parameters: Locale - prefered locale empty string(prevent NullPointerException) if sourceString is null or empty(""); otherwise RFC2047 conformed string, eg, "=?Iso8859-1?Q....." |
|
|