Fix a bug that url encoding fails if char is unsigned

GitHub: fixes #217
Fix a bug that html mapping fails if char is unsigned

GitHub: fixes #218