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

This commit is contained in:
Reece H. Dunn
2017-03-28 07:57:44 +01:00
parent a6eac922bd
commit 7da585e25e
3 changed files with 63 additions and 0 deletions
+31
View File
@@ -312,6 +312,36 @@ test_iso_8859_7_encoding()
destroy_text_decoder(decoder);
}
void
test_iso_8859_8_encoding()
{
printf("testing ISO-8859-8 encoding\n");
assert(espeak_ng_EncodingFromName("ISO-8859-8:1988") == ESPEAKNG_ENCODING_ISO_8859_8);
assert(espeak_ng_EncodingFromName("ISO-8859-8") == ESPEAKNG_ENCODING_ISO_8859_8);
assert(espeak_ng_EncodingFromName("ISO_8859-8") == ESPEAKNG_ENCODING_ISO_8859_8);
assert(espeak_ng_EncodingFromName("iso-ir-138") == ESPEAKNG_ENCODING_ISO_8859_8);
assert(espeak_ng_EncodingFromName("hebrew") == ESPEAKNG_ENCODING_ISO_8859_8);
assert(espeak_ng_EncodingFromName("csISOLatinHebrew") == ESPEAKNG_ENCODING_ISO_8859_8);
espeak_ng_TEXT_DECODER *decoder = create_text_decoder();
assert(text_decoder_decode_string(decoder, "aG\x92\xA0\xEE", 5, ESPEAKNG_ENCODING_ISO_8859_8) == 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) == 0x05de);
assert(text_decoder_eof(decoder) == 1);
destroy_text_decoder(decoder);
}
int
main(int argc, char **argv)
{
@@ -325,6 +355,7 @@ main(int argc, char **argv)
test_iso_8859_5_encoding();
test_iso_8859_6_encoding();
test_iso_8859_7_encoding();
test_iso_8859_8_encoding();
printf("done\n");
return EXIT_SUCCESS;