Character encoding problem - InfoPath Dev
in

InfoPath Dev

Character encoding problem

Last post 02-08-2011 06:25 PM by parminder. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 01-11-2009 07:59 AM

    Character encoding problem

    Hi,

    I have an infopath form where users will frequently copy and paste text from a word document or .pdf file into both standard text boxes and rich text boxes. The form allows the user to input the text and save the infopath form however sometimes when you re-open the form there is an error such as this

     The form contains XML that cannot be parsed:
    An invalid character was found in text content.

    Line 6, Position 9
    The Fund
    --------^

     

     The text should read: The Fund's


    I am able to edit the xml file using notepad and find the offending character which is usually an apostrophe, quotation marks, French or German accents on letters and empty spaces. If I remove the character(s) I am able to open the file in infopath. As an alternative to replacing the characters, I can also open the file and ensure that in the first line <?xml version="1.0"?>  or <?xml version="1.0" encoding="UTF-8"?> is replaced with <?xml version="1.0" encoding="iso-8859-1" ?>.

    Now I could go through each one of my .xml data files and make that replacement but firstly, as i understand it, UTF-8 is the preferred method to encode xml and iso-8859-1 is being phased out, and secondly I would have to go and make the replacement every time a user creates a brand new xml file using the infopath form because I don't know how to change the default encoding from UTF-8 to iso-8859-1.

    What would be better is if these characters could be automatically converted or some validation came up to warn the user that one of the character they have entered is not going to work.

    Here - ' - is an example of one of the characters. However, it appears differently in notepad than it looks in this message. It is a more shaped (i.e. like a tear drop) apostrophe rather than the straight line apostrophe - ' - that I get if I press the apostrophe key on my keyboard.

    Can anybody give me more details on why I am experiencing this problem and what the best solution to it would be?

    Many thanks,

    Jamie

     


  • 01-11-2009 10:55 PM In reply to

    • Shiva
    • Top 25 Contributor
    • Joined on 04-15-2005
    • India
    • Posts 694

    Re: Character encoding problem

    Hello Welcome to the Forums,

    InfoPath forms will save in the format of .xml file. XML have its own properties and it should be well structured format. If we have any unnecessary characters includes in the data then it won't accept. If you copied the data to rich text box then it has own tags and it will accept all character without giving any error. These characters might not support for InfoPath forms.

    If we insert any image or copy from other form then it will accepts without giving any error but If we copy the data from any other rich text box to another rich text box then it will give error sometimes. In those data in build have html format and which contains some tags and if we copy from other rich text box it would create one tag for those data then it would problem for InfoPath forms.

    In xml format, apostrophe character is not accepts in tag name. If the form contains data and node name is well structured and it should support for xml file format rules then it would open the form correctly in InfoPath.

  • 02-08-2011 06:25 PM In reply to

    Re: Character encoding problem

     I am facing the same problem, apostrophe when entered in the TEXT field of Infopath form and saved. When I reopen the form does not open. Yes if edit the XML file and remove the apostrophe it works.

     The XML is generated by InfoPath, this form is a browser enabled form for SharePoint form library. And the Tags are well structured.

Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.