[buffer] Refactoring and fix Buffer(string, encoding)