Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 249513
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T21:26:01+00:00 2026-05-11T21:26:01+00:00

I am writing an app that ultimately wants to send some XML via email.

  • 0

I am writing an app that ultimately wants to send some XML via email.

I have the mailto/URL thing sussed, thanks to various links on the interweb, including Brandon and Simon Maddox.

So I can send emails with the xml formatted using square brackets ([ ]), rather than the usual angle brackets (< >). But when I send angle brackets, with the XML mangled using the stringByAddingPercentEscapesUsingEncoding call, It treats it as HTML and just prints the values.

If change them to "& lt;" and "& gt;" then it totally strips the XML out… (I know there should not be a space after the & – but the SO formatter turns them into <,>…)

I tried adding some HTML in front to see if that helped, to no avail.

I don’t suppose anyone has done this?

Perhaps in-app email is the easy route for me to go… must look into that.

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T21:26:01+00:00Added an answer on May 11, 2026 at 9:26 pm

    The following code worked for me… I have SIP message data containing <> that needed escaping.

    /* remember to call urlEscapeStringDone to free the malloced string.. */
    char *urlEscapeString(char *str)
    {
        int i, l;
        char *escStr;
    
        escStr = malloc(strlen(str)*3 + 1);
        if(!escStr) return NULL;
    
        memset(escStr, 0, strlen(str)*3);
    
        l = strlen(escStr);
        for(i = 0; i < strlen(str); i++)
        {
            char c = str[i];
    
            /* < and > handling for HTML interpreters.. (apple mail) */
            if(c == '<')
            {
                strcat(escStr, "%26lt%3b");
                l += 8;
            }
            else if(c == '>')
            {
                strcat(escStr, "%26gt%3b");
                l += 8;
            }
            else if(must_escape(c))
            {
                char tmp[3];
    
                sprintf(tmp, "%02x", (unsigned) c);
                escStr[l] = '%'; l++;
                escStr[l] = tmp[0]; l++;
                escStr[l] = tmp[1]; l++;
            }
            else
            {
                escStr[l] = str[i];
                l++;
            }
        }
    
        printf("escaped: %s\n", escStr);
    
        return escStr;
    }
    
    void urlEscapeStringDone(char *str)
    {
        if(str) free(str);
    }
    
    int must_escape(char c)
    {
        char *allowedChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789._";
    
        if(!strchr(allowedChars, c)) return 1;
        return 0;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am writing an app that will send an email using the Java Mail
I am writing an app that plays a url using MPMoviePlayerController. The app works
I'm writing an app that needs some JNI code. This code involves floating point
I am currently writing an app that I have a SQLite DB that contains
I am writing an app that may have in its memory quite a bit
I'm writing an app that allows me to send a command through TCP/IP by
I'm writing an app that uses some functions and classes only available in the
I am writing an app that plays some simple voices and sounds using AVAudioPlayer
I'm writing a app that exposes a REST API. Some of the query parameters
I am writing an app that needs to send emails at the end of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.