s = e;
}
else {
- /* Native bytes - can always encode */
- U8 *d = (U8 *) SvGROW(dst,2*slen);
- while (s < e) {
- UV uv = NATIVE_TO_UNI((UV) *s++);
- if (UNI_IS_INVARIANT(uv))
- *d++ = (U8)UTF_TO_NATIVE(uv);
- else {
- *d++ = (U8)UTF8_EIGHT_BIT_HI(uv);
- *d++ = (U8)UTF8_EIGHT_BIT_LO(uv);
- }
+ /* Native bytes - can always encode */
- U8 *d = (U8 *) SvGROW(dst,2*slen);
++ U8 *d = (U8 *) SvGROW(dst,2*slen+1);
+ while (s < e) {
+ UV uv = NATIVE_TO_UNI((UV) *s++);
+ if (UNI_IS_INVARIANT(uv))
+ *d++ = (U8)UTF_TO_NATIVE(uv);
+ else {
+ *d++ = (U8)UTF8_EIGHT_BIT_HI(uv);
+ *d++ = (U8)UTF8_EIGHT_BIT_LO(uv);
+ }
}
- SvCUR_set(dst, d- (U8 *)SvPVX(dst));
- *SvEND(dst) = '\0';
+ SvCUR_set(dst, d- (U8 *)SvPVX(dst));
+ *SvEND(dst) = '\0';
}
/* Clear out translated part of source unless asked not to */