refactoring & update libchardet to 1.0.3