{
errorList.addError(ErrorHandler.MINOR_ERROR, "Escape character found at end of field, discarding it.");
}
else
{
throw new MarcException("Escape character found at end of field");
}
break;
}
switch (data[cdt.offset + 1 + extra]) {
case 0x28: // '('
case 0x2c: // ','
set_cdt(cdt, 0, data, 2 + extra, false);
break;
case 0x29: // ')'
case 0x2d: // '-'
set_cdt(cdt, 1, data, 2 + extra, false);
break;
case 0x24: // '$'
if (!loadedMultibyte) {
loadMultibyte();
loadedMultibyte = true;
}
switch (data[cdt.offset + 2 + extra + extra2]) {
case 0x29: // ')'
case 0x2d: // '-'
set_cdt(cdt, 1, data, 3 + extra + extra2, true);
break;
case 0x2c: // ','
set_cdt(cdt, 0, data, 3 + extra + extra2, true);
break;
case 0x31: // '1'
cdt.g0 = data[cdt.offset + 2 + extra + extra2];
cdt.offset += 3 + extra + extra2;
cdt.multibyte = true;
break;
case 0x20: // ' '
// space found in escape code: look ahead and try to proceed
extra2++;
break;
default:
// unknown code character found: discard escape sequence and return
cdt.offset += 1;
if (errorList != null)
{
errorList.addError(ErrorHandler.MINOR_ERROR, "Unknown character set code found following escape character. Discarding escape character.");
}
else
{
throw new MarcException("Unknown character set code found following escape character.");
}
break;
}
break;
case 0x67: // 'g'
case 0x62: // 'b'
case 0x70: // 'p'
cdt.g0 = data[cdt.offset + 1 + extra];
cdt.offset += 2 + extra;
cdt.multibyte = false;
break;
case 0x73: // 's'
cdt.g0 = 0x42;
cdt.offset += 2 + extra;
cdt.multibyte = false;
break;
case 0x20: // ' '
// space found in escape code: look ahead and try to proceed
if (errorList == null)
{
throw new MarcException("Extraneous space character found within MARC8 character set escape sequence");
}
extra++;
break;
default:
// unknown code character found: discard escape sequence and return
cdt.offset += 1;
if (errorList != null)
{
errorList.addError(ErrorHandler.MINOR_ERROR, "Unknown character set code found following escape character. Discarding escape character.");
}
else
{
throw new MarcException("Unknown character set code found following escape character.");
}
break;
}
}
if (errorList != null && ( extra != 0 || extra2 != 0))