if (bof)
{
PL_bufend = SvPVX(PL_linestr) + SvCUR(PL_linestr);
- /* Shouldn't this wsallow_bom() be earlier, e.g.
+ /* Shouldn't this swallow_bom() be earlier, e.g.
* immediately after where bof is set? Currently you can't
* have e.g. a UTF16 sharpbang line. --Mike Guy */
s = swallow_bom((U8*)s);
S_swallow_bom(pTHX_ U8 *s)
{
STRLEN slen;
+ U8 *olds = s;
slen = SvCUR(PL_linestr);
switch (*s) {
case 0xFF:
s += 2;
filter_add(utf16rev_textfilter, NULL);
New(898, news, (PL_bufend - (char*)s) * 3 / 2 + 1, U8);
+ /* See the notes on utf16_to_utf8() in utf8.c --Mike Guy */
PL_bufend = (char*)utf16_to_utf8((U16*)s, news,
PL_bufend - (char*)s);
+ Safefree(olds);
s = news;
#else
Perl_croak(aTHX_ "Unsupported script encoding");
U8 *news;
filter_add(utf16_textfilter, NULL);
New(898, news, (PL_bufend - (char*)s) * 3 / 2 + 1, U8);
+ /* See the notes on utf16_to_utf8() in utf8.c --Mike Guy */
PL_bufend = (char*)utf16_to_utf8((U16*)s, news,
PL_bufend - (char*)s);
+ Safefree(olds);
s = news;
#else
Perl_croak(aTHX_ "Unsupported script encoding");
* a hard error (and it should be listed in perldiag).
* (4) The tests (in comp/t/require.t) are a joke: the UTF16 BOM
* really ought to be followed by valid UTF16 characters.
+ * See swallow_bom() in toke.c.
* --Mike Guy */
U8*
Perl_utf16_to_utf8(pTHX_ U16* p, U8* d, I32 bytelen)