Skip to content

Instantly share code, notes, and snippets.

View choose0or7's full-sized avatar

Yu choose0or7

View GitHub Profile
@choose0or7
choose0or7 / Charset.cls
Last active June 5, 2018 19:03 — forked from nxtr/Charset.cls
Salesforce Force.com Apex: encode and decode string to / from binary characters in charset
public abstract class Charset {
/**
* Convenience method that encodes a string into bytes in charset.
* <p>
* @param input string of Unicode characters
* @param charset name according to http://www.iana.org/assignments/character-sets/character-sets.xhtml
* @return binary characters in charset
*/
public static Blob encode(final String input, final String charset) {