Escaping or ignoring special characters in uploaded pdf

We have special characters in our PDF, which where causing WebViewer to ignore the fields with special characters in its field name (https://groups.google.com/forum/#!msg/pdfnet-sdk/7jyjGGRjRR4/wujIQkX8BQAJ;context-place=forum/pdfnet-sdk). We circumvented the issue by escaping them in our server as webviewer failed to escape them.

`
class FormDataParser
def self.escape_single_quote(form_data)
substitute(form_data, ‘’’, ‘’’)
end

def self.unescape_single_quote(form_data)
substitute(form_data, ‘’’, ‘’’)
end

private

def self.substitute(form_data, pattern, replace)
doc = Nokogiri::HTML::DocumentFragment.parse(form_data, ‘UTF-8’)
doc.xpath(’.//field’).each do |field|
field.attributes[‘name’].value = field.attributes[‘name’].value.gsub(pattern, replace)
end
doc.xpath(’.//widget’).each do |widget|
widget.attributes[‘field’].value = widget.attributes[‘field’].value.gsub(pattern, replace)
end
doc.xpath(’.//ffield’).each do |ffield|
ffield.attributes[‘name’].value = ffield.attributes[‘name’].value.gsub(pattern, replace)
end
doc
end
end
`

This solved problem with \, but double quotes " is still a conundrum. Please help