How do I add an "ñ" character using the .net SDF API?


I’m trying to add “España” as the location of a digital signature dictionary (following But when I just add in the string like sigDict.PutString(“Location”, “España”), the location appears garbled when I open the document in another PDF viewer. How can I fix this?


This variant of the PutString API ( performs an implicit encoding conversion. To avoid the conversion, pass in a byte array instead (; e.g., by calling sigDict.PutString(“Location”, Encoding.Default.GetBytes(“España”)). Doing so should create the characters correctly.

Note also — if you want to store a string using Unicode (i.e. PDF Text Encoding according to PDF spec) you could try
sigDict.PutText(“Location”, “España”);