Skip to content

Commit

Permalink
Use UTF-8 encoding in base64Decode (#150) (#151)
Browse files Browse the repository at this point in the history
  • Loading branch information
kiejo authored and tngan committed Nov 9, 2017
1 parent 2af8f07 commit b5b035d
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/utility.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { isString } from 'lodash';
import { DOMParser } from 'xmldom';

const BASE64_STR = 'base64';
const ASCII_STR = 'ascii';
/**
* @desc Encode string with base64 format
* @param {string} message plain-text message
Expand All @@ -27,7 +26,7 @@ function base64Encode(message: string) {
*/
export function base64Decode(base64Message: string, isBytes?: boolean): string | Buffer {
const bytes = new Buffer(base64Message, BASE64_STR);
return Boolean(isBytes) ? bytes : bytes.toString(ASCII_STR);
return Boolean(isBytes) ? bytes : bytes.toString();
}
/**
* @desc Compress the string
Expand Down

0 comments on commit b5b035d

Please sign in to comment.