Skip to content

Instantly share code, notes, and snippets.

@ztirom
Last active April 22, 2016 17:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ztirom/9f4917d8416c2f417e744150f908f3eb to your computer and use it in GitHub Desktop.
Save ztirom/9f4917d8416c2f417e744150f908f3eb to your computer and use it in GitHub Desktop.
Make a byte64 String from an UTF-8 String in AX2012
static void strToBase64Str(Args _args)
{
System.Byte[] byte;
str str64 = "QVgyMDEyUjNDVTk=",
strUTF8Output;
System.Text.Encoding encoding = System.Text.Encoding::get_UTF8();
// base64 Input
byte = System.Convert::FromBase64String(str64);
// UTF8 output
strUTF8Output = encoding.GetString(byte);
// result
info(strFmt("base64: %1", str64));
info(strFmt("UTF8 output: %1", strUTF8Output));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment