encoding.c: Support the ISO 8859-14 encoding.

This commit is contained in:
Reece H. Dunn
2017-03-29 07:19:16 +01:00
parent 24faceab57
commit 0235c42652
3 changed files with 64 additions and 1 deletions
+33
View File
@@ -457,6 +457,38 @@ test_iso_8859_13_encoding()
destroy_text_decoder(decoder);
}
void
test_iso_8859_14_encoding()
{
printf("testing ISO-8859-14 encoding\n");
assert(espeak_ng_EncodingFromName("ISO-8859-14:1998") == ESPEAKNG_ENCODING_ISO_8859_14);
assert(espeak_ng_EncodingFromName("ISO-8859-14") == ESPEAKNG_ENCODING_ISO_8859_14);
assert(espeak_ng_EncodingFromName("ISO_8859-14") == ESPEAKNG_ENCODING_ISO_8859_14);
assert(espeak_ng_EncodingFromName("iso-ir-199") == ESPEAKNG_ENCODING_ISO_8859_14);
assert(espeak_ng_EncodingFromName("iso-celtic") == ESPEAKNG_ENCODING_ISO_8859_14);
assert(espeak_ng_EncodingFromName("latin8") == ESPEAKNG_ENCODING_ISO_8859_14);
assert(espeak_ng_EncodingFromName("l8") == ESPEAKNG_ENCODING_ISO_8859_14);
assert(espeak_ng_EncodingFromName("csISO885914") == ESPEAKNG_ENCODING_ISO_8859_14);
espeak_ng_TEXT_DECODER *decoder = create_text_decoder();
assert(text_decoder_decode_string(decoder, "aG\x92\xA0\xDE", 5, ESPEAKNG_ENCODING_ISO_8859_14) == ENS_OK);
assert(text_decoder_eof(decoder) == 0);
assert(text_decoder_getc(decoder) == 'a');
assert(text_decoder_eof(decoder) == 0);
assert(text_decoder_getc(decoder) == 'G');
assert(text_decoder_eof(decoder) == 0);
assert(text_decoder_getc(decoder) == 0x92);
assert(text_decoder_eof(decoder) == 0);
assert(text_decoder_getc(decoder) == 0xA0);
assert(text_decoder_eof(decoder) == 0);
assert(text_decoder_getc(decoder) == 0x0176);
assert(text_decoder_eof(decoder) == 1);
destroy_text_decoder(decoder);
}
int
main(int argc, char **argv)
{
@@ -478,6 +510,7 @@ main(int argc, char **argv)
test_iso_8859_11_encoding();
// ISO-8859-12 is not a valid encoding.
test_iso_8859_13_encoding();
test_iso_8859_14_encoding();
printf("done\n");