java.lang.Object | |
↳ | com.microstrategy.web.app.transforms.CharsetEncoderWithSpecialChar |
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
protected ICharsetModifiable | modifier |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
CharsetEncoderWithSpecialChar() |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
void |
flush()
This function flush the regular char from byteBuffin to byteBuffOut with correct encoding.
| ||||||||||
void |
transcode(MarkupOutput mo, String decodeName, String encodeName, byte[] data)
Called when the charset specified is "SJIS" or "Shift_JIS" (Japanese).
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
void |
encodeSpecialCharacter(byte b1, byte b2)
Encodes one character as Shift JIS
This is done to special-encode some problematic characters into SJIS because they are not properly encoded by Java. | ||||||||||
void |
pushSpecialChar(byte b1, byte b2)
Push the special encoded bytes to the output byte buffer.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() | |||||||||||
![]() |
This function flush the regular char from byteBuffin to byteBuffOut with correct encoding.
If byteBuffIn is empty, it will do nothing. byteBuffIn will be cleared by this function.
DO NOT OVERRIDE, protected for visibility only.
IOException | |
---|---|
UnsupportedEncodingException |
Called when the charset specified is "SJIS" or "Shift_JIS" (Japanese).
This is done to special-encode some problematic characters into SJIS because they are not properly encoded by Java.
For more information see: http://www-01.ibm.com/support/docview.wss?rs=133&context=SS5RG2&dc=DB560&dc=DB520&uid=swg21064197&loc=en_US&cs=UTF-8&lang=en&rss=ct133rational
In addition to the characters mentioned on this link we also special encode circled numbers from 1 to 20 which also break in Japanese
Calls encodeShiftJISCharacter(byte[], String) for each character (2 bytes)
mo | The output object |
---|---|
decodeName | the charset specified as supported by Java to decode the data |
encodeName | the charset to encode the data |
data | an array with the bytes as passed by IServer. These bytes are encoded using "UnicodeLittle". |
IllegalArgumentException | if an error occurs when appending data to the markup output |
---|---|
IllegalStateException | if an error occurs when appending data to the markup output |
UnsupportedEncodingException | if an error occurs when appending data to the markup output |
IOException |
Encodes one character as Shift JIS
This is done to special-encode some problematic characters into SJIS because they are not properly encoded by Java.
For more information see: http://www-01.ibm.com/support/docview.wss?rs=133&context=SS5RG2&dc=DB560&dc=DB520&uid=swg21064197&loc=en_US&cs=UTF-8&lang=en&rss=ct133rational
In addition to the characters mentioned on this link we also special encode circled numbers from 1 to 20 which also break in Japanese
This can be overwritten to encode extra characters
The recommended overwritten code snippet:
protected void encodeShiftJISCharacter(byte b1, byte b2) throws UnsupportedEncodingException {
if (b1 == 0x15 && b2 == 0x20) {//double dash
pushSpecialChar((byte) 0x81, (byte) 0x5c)
} else {
super.encodeShiftJISCharactor(b1,b2);
}
}
IOException | |
---|---|
UnsupportedEncodingException |
Push the special encoded bytes to the output byte buffer. If different number of bytes are needed, use flushRegularChar() function follow by byteBuffOut.put(b1).put(b2)...put(bn)
b1 | is the first encoded byte |
---|---|
b2 | is the second encoded byte |
UnsupportedEncodingException | |
---|---|
IOException |