Fixes to numToChar/charToNum

Unlike the new native/unicode functions, these need to maintain the old and slightly broken behaviour for backwards compatibility.