flocking character encoding from a PDF to eConnect
In Dynamics GP SOP line detail entry we have a custom helper window whose task it is to automatically create a new inventory item for our sales staff, when they need one for special orders.
The work flow is that the details (as shown in screenshot) of the item to be created are copied and pasted from our supplier’s documentation into the window fields and then the assign button is clicked. A new items and price is created by eConnect in the background and that newly created item is added to the current order window.
I was called to look at an exception caused by the add-in window, it turned out to be eConnect moaning about invalid XML characters.
Here is the text that was being copied into the item description field of the form.
I retyped the dashes and removed and reinserted the spaces, as they were obvious candidates to be outside normal character ranges. Still it was failing with invalid XML character exception. I manually typed it all and it worked. Next move was to paste the text into notepad++.
Notice the [US] block, look again at the fl in the above text, it turns out that it is a character ligature! Really easy to miss when under pressure to get an issue resolved. The “fl” is actually one special character.
The real lesson here is to clean the user input when accepting it to be used by eConnect. As these kind of characters should not be allowed into GP (in my opinion), perhaps it should cause a validation error on the field? An alternative is to replace the odd characters with a question marks in the onvalidate event, a convention seen in some other applications. This would draw the attention of the user to the unusual character(s).
I’ve added a validator and all is now well.