BUG: Fix issue with PR #3491

Don't convert unicode string to ascii string before getting byte length. Also, get length of non string type as ascii or unicode depending on output string type.
Merge pull request #3761 from ContinuumIO/2890_fix

Fix for PR #3491