diff --git a/src/libespeak-ng/readclause.c b/src/libespeak-ng/readclause.c index e0f9fe3f..9a7cb3a4 100644 --- a/src/libespeak-ng/readclause.c +++ b/src/libespeak-ng/readclause.c @@ -753,12 +753,7 @@ int ReadClause(Translator *tr, char *buf, short *charix, int *charix_top, int n_ if ((c1 <= 0x20) && ((sayas_mode == SAYAS_SINGLE_CHARS) || (sayas_mode == SAYAS_KEY))) c1 += 0xe000; // move into unicode private usage area } else if ((c1 == '<') && (ssml_ignore_l_angle != '<')) { - if ((c2 == '!') || (c2 == '?')) { - // a comment, ignore until closing '<' (or ')) - c1 = GetC(); - c2 = ' '; - } else if ((c2 == '/') || iswalpha(c2)) { + if ((c2 == '/') || iswalpha(c2) || c2 == '!' || c2 == '?') { // check for space in the output buffer for embedded commands produced by the SSML tag if (ix > (n_buf - 20)) { // Perhaps not enough room, end the clause before the SSML tag diff --git a/src/libespeak-ng/ssml.c b/src/libespeak-ng/ssml.c index 1bc849a7..de811d84 100644 --- a/src/libespeak-ng/ssml.c +++ b/src/libespeak-ng/ssml.c @@ -574,6 +574,11 @@ int ProcessSsmlTag(wchar_t *xml_buf, char *outbuf, int *outix, int n_outbuf, con PARAM_STACK *sp; SSML_STACK *ssml_sp; + // don't process comments and xml declarations + if (wcsncmp(xml_buf, (wchar_t *) "!--", 3) == 0 || wcsncmp(xml_buf, (wchar_t *) "?xml", 4) == 0) { + return 0; + } + // these tags have no effect if they are self-closing, eg. static char ignore_if_self_closing[] = { 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0 };