> Generally I don't think it is safe to do this.

Are you saying "also in this case" or "in this case, it's different"? If it's "also in this case", what would be a better solution? Accept a charset as a parameter?