Today I got a surprise with regards to how InfoPath handled whitespace in strings. Our data contained text that was nicely aligned using TAB characters and sometimes mono-spaced font with multiple space characters. While testing my form, I noticed that all the formatting was gone when displayed in InfoPath even if the whitespace was preserved in the XML data. All TABs and all sequences of spaces got converted into a single space.
In addition, I could not enter TABs in the text box using the keyboard. The same thing happend with \t characters added to strings in the form code (JScript).
I inspected the properties of the text box, and the only formatting option available is "Paragraph breaks". As my options were limited, I chose that option and re-loaded the XML data. I was mildly delighted when all the alignment stuff in the string data were displayed correctly, including the TAB characters. I can now also enter TABs from the keyboard using CTRL-TAB.
The InfoPath team has blogged about line breaks (CR LF \r \n), and they outline how to make these formatting characters available in rules. Their solution should also be applicable to TAB.