String encoding related code.

Add function to encode/decode UTF8.