matlab url encoding doubt
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
endystrike
am 3 Jan. 2022
Beantwortet: Steven Lord
am 3 Jan. 2022
if I encode the following text
str = 'Hello\nWorld';
enc = urlencode(str)
I get this output that is wrong:
enc =
'Hello%5CnWorld'
instead of this one that would be the correct one:
enc =
'Hello%0AWorld'
Is it possible to change the behavior so that '\n' is converted into '%0A' instead of '%5Cn'?
0 Kommentare
Akzeptierte Antwort
Steven Lord
am 3 Jan. 2022
s1 = 'Hello\nWorld'
s1E = urlencode(s1)
s2 = sprintf('Hello\nWorld')
s2E = urlencode(s2)
whos
s1 contains 12 characters including both \ and n while s2 contains 11 including a newline. Just because text includes the pair of characters '\n' doesn't mean that's treated as a newline.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu FPGA, ASIC, and SoC Development finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!