2017-05-09 03:33:45 -05:00
|
|
|
fn issue1468() {
|
|
|
|
euc_jp_decoder_functions!({
|
2017-06-11 23:01:41 -05:00
|
|
|
let trail_minus_offset = byte.wrapping_sub(0xA1);
|
|
|
|
// Fast-track Hiragana (60% according to Lunde)
|
2017-11-01 01:33:55 -05:00
|
|
|
// and Katakana (10% according to Lunde).
|
2017-06-11 23:01:41 -05:00
|
|
|
if jis0208_lead_minus_offset == 0x03 && trail_minus_offset < 0x53 {
|
|
|
|
// Hiragana
|
|
|
|
handle.write_upper_bmp(0x3041 + trail_minus_offset as u16)
|
|
|
|
} else if jis0208_lead_minus_offset == 0x04 && trail_minus_offset < 0x56 {
|
|
|
|
// Katakana
|
|
|
|
handle.write_upper_bmp(0x30A1 + trail_minus_offset as u16)
|
|
|
|
} else if trail_minus_offset > (0xFE - 0xA1) {
|
|
|
|
if byte < 0x80 {
|
|
|
|
return (
|
|
|
|
DecoderResult::Malformed(1, 0),
|
|
|
|
unread_handle_trail.unread(),
|
|
|
|
handle.written(),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
return (
|
|
|
|
DecoderResult::Malformed(2, 0),
|
|
|
|
unread_handle_trail.consumed(),
|
|
|
|
handle.written(),
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
unreachable!();
|
|
|
|
}
|
|
|
|
});
|
2017-05-09 03:33:45 -05:00
|
|
|
}
|