I have a user who has placed an Order via PayPal which feeds back to the Nwazet.Commerce.OrderService.CreateOrder method (so it seems it could also happen in Stripe). This individual is from the country of Lithuania and the street address they provided has an invalid character in it (at least as far as my American keyboard and ultimately XML is concerned). As a result, the following error is thrown:
System.ArgumentException: '', hexadecimal value 0x1A, is an invalid character.
This error stems from:
though it could stem from any of these methods. So my question is whether there is a single method / override we can apply to escape the invalid characters.
There is a discussion here: http://stackoverflow.com/questions/8331119/escape-invalid-xml-characters-in-c-sharp about invalid characters. I am wondering if we can use:
SecurityElement.Escape(text); (from System.Security)
to escape all our incoming text and pull these invalid characters out. Could it be implemented at the "ToAttr" method so it is automatically applied against all entries?