Skip to content

Commit

Permalink
Merge branch 'master' of github.com:devongovett/pdfkit
Browse files Browse the repository at this point in the history
  • Loading branch information
devongovett committed May 30, 2017
2 parents d35f7cc + ed07a06 commit 520096a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/object.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,7 @@ class PDFObject

# String objects are converted to PDF strings (UTF-16)
else if object instanceof String
# Escape characters as required by the spec
string = object.replace escapableRe, (c) ->
return escapable[c]

string = object
# Detect if this is a unicode string
isUnicode = false
for i in [0...string.length] by 1
Expand All @@ -53,6 +50,10 @@ class PDFObject
if isUnicode
string = swapBytes(new Buffer('\ufeff' + string, 'utf16le')).toString('binary')

# Escape characters as required by the spec
string = string.replace escapableRe, (c) ->
return escapable[c]

'(' + string + ')'

# Buffers are converted to PDF hex strings
Expand Down

0 comments on commit 520096a

Please sign in to comment.