0

I'm using Node.js and I found out that when I send GET call to a server with C++ then in SQL binding I get C(blank space)(bankspace) (checked with console.log(req.query.keywords) so essentialy the same length of the string, but no chars there.

When I use SELECT * FROM jobs WHERE keywords LIKE' %c++%'; it works normally and gives me results. Is there something I don't know about Node - like it's dropping signs like +?

Akber Iqbal
  • 14,487
  • 12
  • 48
  • 70
jean d'arme
  • 4,033
  • 6
  • 35
  • 70

1 Answers1

1

I think the issue you're having is the same one outlined here: URLs and plus signs

The issue is that a GET is going to use the query string in the URL and plus signs need to be formatted (or encoded) similar to how a space is formatted as %20 in URLs. You could probably use or create a UrlEncoding method in your application.

In Node, I believe you can use something like: encodeURIComponent('C++')

The URL encoding for + is %2B

Brian Wright
  • 827
  • 6
  • 9