Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Curl Command - Issue with Special Characters

Avatar

Avatar
Validate 1
Level 2
toshbot
Level 2

Likes

3 likes

Total Posts

14 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 3
Boost 1
Affirm 1
View profile

Avatar
Validate 1
Level 2
toshbot
Level 2

Likes

3 likes

Total Posts

14 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 3
Boost 1
Affirm 1
View profile
toshbot
Level 2

13-07-2017

Hi Folks,

I am trying to perform tree activation using a Curl command. The path contains special characters (from Spanish words). So, for example, this is the command I am executing:

curl -u admin:admin -F cmd=activate -F ignoredeactivated=true -F onlymodified=true -F path=/content/geometrixx/Cómo Hacer y Recibir Llamadas Telefónicas.png http://localhost:4502/etc/replication/treeactivation.html

When I try to execute this command, the word "Cómo" gets processed as "Cómo", and "Telefónicas" as "Telefónicas". Since there is no file with the word "Cómo", or "Telefónicas", the command fails.

Is there a way to process these special characters correctly for curl commands? Thank you.

desktop_exl_promo_600x100_weknowyou.png

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Boost 5
Level 4
zeeshank1500736
Level 4

Likes

29 likes

Total Posts

103 posts

Correct Reply

33 solutions
Top badges earned
Boost 5
Boost 3
Boost 25
Boost 10
Boost 1
View profile

Avatar
Boost 5
Level 4
zeeshank1500736
Level 4

Likes

29 likes

Total Posts

103 posts

Correct Reply

33 solutions
Top badges earned
Boost 5
Boost 3
Boost 25
Boost 10
Boost 1
View profile
zeeshank1500736
Level 4

13-07-2017

Hi toshbot,

Solution one: It is converting the Special character to an Encoding but not in UTF-8 (browser specific encoding).Can you paste this(/content/geometrixx/Cómo Hacer y Recibir Llamadas Telefónicas.png) to browser so that the url will be already in Encode Form and then use this encoded path to your Curl command.

Solution Two :  Use --data-urlencode curl - How To Use Check this Examples linux - How to Post Url in data of a curl request - Stack Overflow

Solution Three : GO through this url http - How do I POST form data with UTF-8 encoding by using curl? - Stack Overflow

This is due to handling of unicode characters in a DOS prompt, see https://stackoverflow.com/questions/388490/unicode-characters-in-windows-command-line-how . You should be able to change this behavior by using a command like chcp 65001 to set the terminal up for UTF-8 handling.

Thanks

Answers (3)

Answers (3)

Avatar

Avatar
Validate 1
Level 2
toshbot
Level 2

Likes

3 likes

Total Posts

14 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 3
Boost 1
Affirm 1
View profile

Avatar
Validate 1
Level 2
toshbot
Level 2

Likes

3 likes

Total Posts

14 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 3
Boost 1
Affirm 1
View profile
toshbot
Level 2

13-07-2017

Hi,

So in the URL, Cómo remains as it is - it isn't encoded to something special.

So, what I actually want is for curl to NOT encode my URL - I want to disable encoding.

Do you know how I can achieve that?

Avatar

Avatar
Boost 5
Level 4
zeeshank1500736
Level 4

Likes

29 likes

Total Posts

103 posts

Correct Reply

33 solutions
Top badges earned
Boost 5
Boost 3
Boost 25
Boost 10
Boost 1
View profile

Avatar
Boost 5
Level 4
zeeshank1500736
Level 4

Likes

29 likes

Total Posts

103 posts

Correct Reply

33 solutions
Top badges earned
Boost 5
Boost 3
Boost 25
Boost 10
Boost 1
View profile
zeeshank1500736
Level 4

13-07-2017

Hi

did you check that image is comming by hitting the original url http://<hostname>:<port>/content/geometrixx/Cómo Hacer y Recibir Llamadas Telefónicas.png.If image is comming then you can use this encoded url in curl command.

If you check this you can use  --data-urlencode before the path of the relative url.

curl --request POST 'http://localhost/Service' --data-urlencode "path=/xyz/pqr/test/";

Avatar

Avatar
Validate 1
Level 2
toshbot
Level 2

Likes

3 likes

Total Posts

14 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 3
Boost 1
Affirm 1
View profile

Avatar
Validate 1
Level 2
toshbot
Level 2

Likes

3 likes

Total Posts

14 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 3
Boost 1
Affirm 1
View profile
toshbot
Level 2

13-07-2017

Hi,

Thank you for your response. Couple of things:

1. Copying and then pasting my URL into a browser, the special character 'ó' still remains the same. It does not change/get encoded.

2. How would you use the encoding in our particular context aka for tree activation? I think the use cases in the first two links you posted will not work. These apply to encoding query parameters - in this case, there are no query parameters.

The path /content/geometrixx/Cómo Hacer y Recibir Llamadas Telefónicas.png does not contain any query params.

Any guidance would be appreciated.