I don't think we should assume the host character encoding here.  We should probably get the character encoding passed in to us.  We might be able to figure it out by looking at the input sequences and guessing, or by looking at a .gitattributes file.