0

Is there any way to determine a string's encoding in Matlab?

Say, I have an encoded string, but I don't know if it is encoded in Base16, Base32 or Base64 encoding, how do I find out?

This is what I need but in c#

 public static bool IsBase64(string base64String)
        {
            if (base64String.Replace(" ", "").Length % 4 != 0)
            {
                return false;
            }

            try
            {
                Convert.FromBase64String(base64String);
                return true;
            }
            catch (FormatException exception)
            {
                // Handle the exception
            }
            return false;
        }

Is there any way to do that in Matlab?

Ayfan
  • 29
  • 6
  • As [this question and it's selected answer](http://stackoverflow.com/questions/1025332/determine-a-strings-encoding-in-c-sharp) point out, if you already have a string, determining it's encoding doesn't make sense. Do you actually have a byte stream, perhaps from a file? – horchler Mar 14 '14 at 21:42
  • @horchler I would assume the _string's_ encoding is irrelevant since base64 etc. only use ASCII characters - I read the question as "how do I figure out what representation was used to convert binary data into this string of characters I have?" – Notlikethat Mar 14 '14 at 21:58

0 Answers0