Truncation of body message when using '&' character with MFMailComposeViewController and MFMessageComposeViewController

StackOverflow https://stackoverflow.com/questions/7742466

  •  09-02-2021
  •  | 
  •  

Question

I have an iPhone app that sends in app email (using MFMailComposeViewController) and SMS messages (using MFMessageComposeViewController).

It works fine sending both types of messages, but I have run into a strange issue when the last word of a message contains the '&' character. Everything including and after the '&' gets truncated when it is opened in the email/sms iPhone built in controls (the controllers I mention above). I will illustrate with a few examples.

  • Sending a message with the text "Hello world" works fine.
  • Sending a message with the text "Hello &world" will truncate the message to "Hello ".
  • Sending a message with the text "Hello worl&d" will truncate the message to "Hello worl".
  • Sending a message with the text "Hello &world&world" will truncate the message to "Hello &world".

The truncation issue only appears in the message body, not the subject (this point is obviously not applicable to sending SMS message).

I have checked with NSLog output that the message is indeed not truncated before it is sent to the message controllers. I have also tested displaying the message with UIAlertView, and the message is not truncated there either.

Is this a bug in iOS or am I just missing something obvious here?

I am developing with iOS SDK 4.3 and the issue has been duplicated on both iPhone3GS and iPad2 devices.

Was it helpful?

Solution

I have confirmed that this was a bug in iOS SDK 4.3. After updating to iOS 5 the problem has disappeared, so I suppose Apple fixed the bug.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top