How to determine if a string matches some character encoding in Elixir

Your best bet would probably be to use one of the text transcoding libraries. Try to convert from your expected codepage to utf8 and if that fails, fail the call or try the next one in priority order.

What are you trying to do, by the way?