ICU-6365 Only write the language code after a linefeed if there are more characters after the linefeed. Update data driven test to check for this.

X-SVN-Rev: 24344
This commit is contained in:
Michael Ow 2008-07-03 15:27:12 +00:00
parent d7ccec764b
commit 0909ccea4d
2 changed files with 23 additions and 21 deletions

View file

@ -910,27 +910,29 @@ static void UConverter_fromUnicode_ISCII_OFFSETS_LOGIC(
/*writing the char to the output stream */
while (source < sourceLimit) {
targetByteUnit = missingCharMarker;
sourceChar = *source++;
tempContextFromUnicode = converterData->contextCharFromUnicode;
/*check if input is in ASCII and C0 control codes range*/
if (sourceChar <= ASCII_END) {
WRITE_TO_TARGET_FROM_U(args,offsets,source,target,targetLimit,sourceChar,err);
/* Write the language code following LF only if LF is not the last character. */
if (args->converter->fromUnicodeStatus == LF) {
targetByteUnit = ATR<<8;
targetByteUnit += (uint8_t) lookupInitialData[range].isciiLang;
args->converter->fromUnicodeStatus = 0x0000;
/* now append ATR and language code */
WRITE_TO_TARGET_FROM_U(args,offsets,source,target,targetLimit,targetByteUnit,err);
if (U_FAILURE(*err)) {
break;
}
if (sourceChar == LF) {
targetByteUnit = ATR<<8;
targetByteUnit += (uint8_t) lookupInitialData[range].isciiLang;
args->converter->fromUnicodeStatus=sourceChar;
/* now append ATR and language code */
WRITE_TO_TARGET_FROM_U(args,offsets,source,target,targetLimit,targetByteUnit,err);
if (U_FAILURE(*err)) {
break;
}
}
sourceChar = *source++;
tempContextFromUnicode = converterData->contextCharFromUnicode;
targetByteUnit = missingCharMarker;
/*check if input is in ASCII and C0 control codes range*/
if (sourceChar <= ASCII_END) {
args->converter->fromUnicodeStatus = sourceChar;
WRITE_TO_TARGET_FROM_U(args,offsets,source,target,targetLimit,sourceChar,err);
if (U_FAILURE(*err)) {
break;
}
continue;
}

View file

@ -1307,9 +1307,9 @@ conversion:table(nofallback) {
// Test Gurmukhi (Bindi Tippi and Consonant clusters)
{
"iscii-gur",
"\u0a15\u0a70\u0a02\u0a71\u0a15\u0a5c\u0a4d\u0a39",
:bin { ef4bb3a2a2b3e8b3bfe9e8d8 },
:intvector{ 0, 0, 0, 1, 2, 3, 3, 3, 5, 5, 6, 7 },
"\u0a15\u0a70\u0a02\u0a71\u0a15\u0a5c\u0a4d\u0a39\u000a\u0043\u0041\u000a",
:bin { ef4bb3a2a2b3e8b3bfe9e8d80aef4b43410a },
:intvector{ 0, 0, 0, 1, 2, 3, 3, 3, 5, 5, 6, 7, 8, 8, 8, 9, 10, 11 },
:int{1}, :int{0}, "", ".", ""
}
// escape callback