>
> So if I find \uFFFD as the last character of a valid but truncated utf8 
> buffer and I strip it, I should always end up with a valid string, right?  

 

> That was an awkward sentence.  Let me try in code.  If buf is the first 
> 512 bytes of a long utf8 file will the following always produce a valid 
> string?

 
    str = buf.toString();
    if (str[str.length-1] is '\uFFFD') str = str.slice(0, -1);

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/979c6a13-27e9-4f02-a7b1-81147e6e081a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to