[fix] transliteration case where a context no match comes at the end of the string
This commit is contained in:
@@ -938,6 +938,7 @@ char *transliterate(char *trans_name, char *str, size_t len) {
|
||||
if (context_no_match && !prev_state.empty_transition && prev_state.phrase_len > 0) {
|
||||
log_debug("Previous phrase stays as is %.*s\n", (int)prev_state.phrase_len, str+prev_state.phrase_start);
|
||||
char_array_cat_len(new_str, str + prev_state.phrase_start, prev_state.phrase_len);
|
||||
state = start_state;
|
||||
}
|
||||
|
||||
if (state.state == TRANS_STATE_BEGIN && !prev_state.empty_transition) {
|
||||
|
||||
@@ -28,6 +28,8 @@ TEST test_transliterators(void) {
|
||||
CHECK_CALL(test_transliteration("han-latin", "街𠀀abcdef", "jiēhēabcdef"));
|
||||
CHECK_CALL(test_transliteration("katakana-latin", "ドウ", "dou"));
|
||||
CHECK_CALL(test_transliteration("hiragana-latin", "どう", "dou"));
|
||||
CHECK_CALL(test_transliteration("latin-ascii-simple", "at&t", "at&t"));
|
||||
CHECK_CALL(test_transliteration("latin-ascii-simple", "at&t", "at&t"));
|
||||
|
||||
PASS();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user