2

How can I evaluate whether a column contains any non-ascii characters in mysql? In this case the charset is actually latin1, so I'm just looking for high-byte chars.

I tried this:

select * from company where ticker regexp concat('[', x'7f', '-', x'ff', ']')

but this returns this error:

ERROR 1139 (42000): Got error 'invalid character range' from regexp

1 Answer 1

9

There must be an easier way to do this, but all the typical escapes I thought would work, didn't. So here is one, ugly solution:

select * from company 
where ticker regexp(concat('[',char(128),'-',char(255),']'));
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.