Include stdio.h when checking for headers.

The header readline/readline.h, and potentially millions of others, have an
implicit dependency on this header. Not including this header would result in a
header check failure.
Rewrite tr_trans method to improve the performance

    - I had add a new private method tr_trans_ascii_only to deal with
      ascii only string.
    - In order to get the best performance, I did not follow the DRY
      rule.
    - Solve multiple char issue(#3015) also.
    - The code still need refactor