Skip to main content
Participant
August 20, 2021
Question

Acrobat XI Pro form imports apostrophe as double quotes.

  • August 20, 2021
  • 2 replies
  • 662 views

In Acrobat XI Pro, I have a form that imports data from a CSV (Comma Separated Value) file.

Whenever the file imports an apostrophe or a single quote, it appears in Acrobat as double quotes.

 

This is a problem for two reason's.

1) If the account name has an apostrophe in the name, it is changed to double quotes. The forms name get's saved using the account name which is a naming violation. (Lowe's gets imported as: Lowe"s). 

2) If the user is telling me 6', I'm seeing 6" (Seeing inches instead of feet is a problem).

 

How can I solve this? 

This topic has been closed for replies.

2 replies

try67
Community Expert
Community Expert
August 20, 2021

If you open the CSV file in a plain-text editor (not in Excel!) I bet you'll see those double single-quotes there, too.

CSV files are problematic in this sense because you have to escape the commas in them (that are a part of the text) by putting the entire values in quotes, but then you have to escape the quotes that you want to actually use in your string... Plus, not all applications do this escaping the same way, or at all, so parsing them back can be tricky.

 

If you can, I would recommend switching over to tab-delimited text files, which are much easier to work with.

MrGadgetAuthor
Participant
September 21, 2021

Sorry for not getting back here sooner.

I thought it would be nice if I gave an update to my problem. After examing the tab-delimited file, it only had the single quote but, the single quote was curly (Chr(146) not Chr(39)). I didn't realize you could have a curly quote in a text file. So in my VBA code, I simply used an if then statement to replace the curly single quote with the straight single quote. 

 

Sub ReplaceRightSmartQuotes()

Dim myRange As Range

Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual

For Each myRange In ActiveSheet.UsedRange

If 0 < InStr(myRange, Chr(146)) Then
myRange = Replace(myRange, Chr(146), Chr(39))
End If
Next

 

Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic

End Sub

 

Hope that can help someone in the same jam.

Thom Parker
Community Expert
Community Expert
August 20, 2021

How exactly is the data imported from the CSV?  Acrobat does not contain any native functionality for reading a CSV file, so the program that does the importing must be what is converting the single quote to a double quote. 

 

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
MrGadgetAuthor
Participant
August 22, 2021

"How exactly is the data imported from the CSV?  Acrobat does not contain any native functionality for reading a CSV file, so the program that does the importing must be what is converting the single quote to a double quote. "

 

Simple Javascript (this.importTextData())

 

I also mistakenly stated I was importing a CSV file but it is actually a tab-delimited file and I did verify that the text file does contain apostrophies (single quotes) not double quotes. So, the problem seems to be either Acrobat or Javascript.

 

Anyone help?

try67
Community Expert
Community Expert
August 22, 2021

You'll need to share the files for further help.