I am developing an android app which is connected to Node.js.
I've got some data in ARTICLE table and it includes 'user_email'. I am trying to get all the articles posted by the current user who logged in.
And this is the result of getting 'member_email' by 'Query'
As you can see, '@' becomes'%40'. I guess it is because of 'Query'. It comes properly when it is 'Body'. But I want to use 'Query' and I need to get all the data:
where user_member = fman1335@gmail.com
with the received data like this:
member_email; fman1335%40gmail.com
Since I only receive the string with '%40' instead of '@', The SQL can't find `fman1335@gmail.com'. So, I need to change '%40' to '@'.
I can change only '%40' part to '@' in the string variable. However, I'd like to know if there's any better way to change this problem technically. For example, encoding or decoding.
@
is %40
URL encoded.
You could use decodeURI()
var uri = 'https://mozilla.org/?x=шеллы';
var encoded = encodeURI(uri);
console.log(encoded);
// expected output: "https://mozilla.org/?x=%D1%88%D0%B5%D0%BB%D0%BB%D1%8B"
try {
console.log(decodeURI(encoded));
// expected output: "https://mozilla.org/?x=шеллы"
} catch(e) { // catches a malformed URI
console.error(e);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.