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 3850268
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T16:58:58+00:00 2026-05-19T16:58:58+00:00

I need to POST short messages to the server. Sometimes they have special characters,

  • 0

I need to POST short messages to the server. Sometimes they have special characters, like in this example:

&message=Joining a game of Commands & Colors: Ancients.

How do I escape special characters from a query string?

I’m using Django. Here’s the field I need to encode:

<textarea class="text-area" id="message" name="message" rows="3" cols="30">
   Joining a game of {{ game.name }}.
</textarea>

UPDATE: I realize that the POST is going through JQuery’s ajax function:

  $("#checkin-button").click(function() { 
          var mid = $("input#mid").val();
          var message = $("textarea#message").val();
          var facebook = $('input#facebook').is(':checked');
          var name = $("input#name").val();
          var bgg_id = $("input#bgg-id").val();
          var thumbnail = $("input#thumbnail").val();
          var dataString = 'mid='+mid+'&message='+message+'&facebook='+facebook+'&name='+name+'&bgg_id='+bgg_id+'&thumbnail='+thumbnail;  
    $.ajax({  
      type: "POST",  
      url: "/game-checkin",  
      data: dataString,  

So I’m not passing that correctly (urlencoded) right?

UPDATE: after realizing the issue was with JQuery, I was able to fix it by replacing the data variable assignment with:

    data: {"mid": mid, "message": message, "facebook": facebook, 
"name": name, "bgg_id": bgg_id, "thumbnail": thumbnail}
  • 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-19T16:58:59+00:00Added an answer on May 19, 2026 at 4:58 pm

    Python:

    >>> urllib.urlencode({'message': 'Joining a game of Commands & Colors: Ancients.'})
    'message=Joining+a+game+of+Commands+%26+Colors%3A+Ancients.'
    

    Django:

    message={{ message|urlencode }}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to post some text to a remote server over HTTP, this server
I need to analyze a users' post and categorize it. For example: I have
I've got a form and I need to post data to the server every
I would like to invoke a webservice via Android. I need to POST some
If I have the xml/html data to post we need to encode the data
I'll try to keep this short and concise. I got my controller here... [AcceptVerbs(HttpVerbs.Post)]
I have a form <form method=post action=sendmail.php name=Email form> Message ID <input type=text name=message_id
I have an ASP.NET web form application that on the server side I need
Since this is a huge post here is a short summary (please read the
I need to post a form on a new website which is UTF-8 encoded.

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.