curl with Umlaut causes âJSON parse error: Invalid UTF-8 middle byte 0x22â [duplicate]
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
This question already has an answer here:
Curl JSON encoded in UTF-8
2 answers
I'm running below curl command from the command line (Git Bash on Windows) or as part of a Bash Script.
curl -s -X POST -H "Content-Type: application/json" -H "Accept: application/json" -d ""testField":"ä"" https://someurl...
Please note that the body of the curl command has an Umlaut ä.
The server which is a Spring Boot REST API running in an AWS Elastic Beanstalk Container returns the following error:
JSON parse error: Invalid UTF-8 middle byte 0x22; nested exception is com.fasterxml.jackson.core.JsonParseException: Invalid UTF-8 middle byte 0x22n at [Source: (PushbackInputStream); line: 1, column: 17]
The same curl command imported into Postman works just fine, so I believe it's rather a curl issue than a server problem.
Any advise on how to get this curl command work is greatly appreciated!
curl unicode special-characters json ascii
marked as duplicate by jayhendren, G-Man, Jesse_b, Vlastimil, Kiwy May 3 at 9:01
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |Â
up vote
0
down vote
favorite
This question already has an answer here:
Curl JSON encoded in UTF-8
2 answers
I'm running below curl command from the command line (Git Bash on Windows) or as part of a Bash Script.
curl -s -X POST -H "Content-Type: application/json" -H "Accept: application/json" -d ""testField":"ä"" https://someurl...
Please note that the body of the curl command has an Umlaut ä.
The server which is a Spring Boot REST API running in an AWS Elastic Beanstalk Container returns the following error:
JSON parse error: Invalid UTF-8 middle byte 0x22; nested exception is com.fasterxml.jackson.core.JsonParseException: Invalid UTF-8 middle byte 0x22n at [Source: (PushbackInputStream); line: 1, column: 17]
The same curl command imported into Postman works just fine, so I believe it's rather a curl issue than a server problem.
Any advise on how to get this curl command work is greatly appreciated!
curl unicode special-characters json ascii
marked as duplicate by jayhendren, G-Man, Jesse_b, Vlastimil, Kiwy May 3 at 9:01
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
Why not use a Unicode escape?
â Ignacio Vazquez-Abrams
May 2 at 20:02
The inputs come from users either as a copy paste or a text file, so I'd like to avoid having to manually convert any extended ascii characters.
â Bernie Lenz
May 2 at 20:10
1
The issue isn't really the accented character; it's that the data encoding does not match the parse encoding. How would your system react if the input were, say, ISO 2022-JP encoded instead of (I assume) Windows code page 1252? Just ignoring text within quotes doesn't cut it, because 0x22 is not always " in ISO 2022-JP. Can you enforce a specific input encoding? If not, can you reliably determine the encoding given?
â Fox
May 2 at 20:55
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
This question already has an answer here:
Curl JSON encoded in UTF-8
2 answers
I'm running below curl command from the command line (Git Bash on Windows) or as part of a Bash Script.
curl -s -X POST -H "Content-Type: application/json" -H "Accept: application/json" -d ""testField":"ä"" https://someurl...
Please note that the body of the curl command has an Umlaut ä.
The server which is a Spring Boot REST API running in an AWS Elastic Beanstalk Container returns the following error:
JSON parse error: Invalid UTF-8 middle byte 0x22; nested exception is com.fasterxml.jackson.core.JsonParseException: Invalid UTF-8 middle byte 0x22n at [Source: (PushbackInputStream); line: 1, column: 17]
The same curl command imported into Postman works just fine, so I believe it's rather a curl issue than a server problem.
Any advise on how to get this curl command work is greatly appreciated!
curl unicode special-characters json ascii
This question already has an answer here:
Curl JSON encoded in UTF-8
2 answers
I'm running below curl command from the command line (Git Bash on Windows) or as part of a Bash Script.
curl -s -X POST -H "Content-Type: application/json" -H "Accept: application/json" -d ""testField":"ä"" https://someurl...
Please note that the body of the curl command has an Umlaut ä.
The server which is a Spring Boot REST API running in an AWS Elastic Beanstalk Container returns the following error:
JSON parse error: Invalid UTF-8 middle byte 0x22; nested exception is com.fasterxml.jackson.core.JsonParseException: Invalid UTF-8 middle byte 0x22n at [Source: (PushbackInputStream); line: 1, column: 17]
The same curl command imported into Postman works just fine, so I believe it's rather a curl issue than a server problem.
Any advise on how to get this curl command work is greatly appreciated!
This question already has an answer here:
Curl JSON encoded in UTF-8
2 answers
curl unicode special-characters json ascii
edited May 2 at 19:56
Jeff Schaller
31.1k846105
31.1k846105
asked May 2 at 19:55
Bernie Lenz
1104
1104
marked as duplicate by jayhendren, G-Man, Jesse_b, Vlastimil, Kiwy May 3 at 9:01
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by jayhendren, G-Man, Jesse_b, Vlastimil, Kiwy May 3 at 9:01
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
Why not use a Unicode escape?
â Ignacio Vazquez-Abrams
May 2 at 20:02
The inputs come from users either as a copy paste or a text file, so I'd like to avoid having to manually convert any extended ascii characters.
â Bernie Lenz
May 2 at 20:10
1
The issue isn't really the accented character; it's that the data encoding does not match the parse encoding. How would your system react if the input were, say, ISO 2022-JP encoded instead of (I assume) Windows code page 1252? Just ignoring text within quotes doesn't cut it, because 0x22 is not always " in ISO 2022-JP. Can you enforce a specific input encoding? If not, can you reliably determine the encoding given?
â Fox
May 2 at 20:55
add a comment |Â
Why not use a Unicode escape?
â Ignacio Vazquez-Abrams
May 2 at 20:02
The inputs come from users either as a copy paste or a text file, so I'd like to avoid having to manually convert any extended ascii characters.
â Bernie Lenz
May 2 at 20:10
1
The issue isn't really the accented character; it's that the data encoding does not match the parse encoding. How would your system react if the input were, say, ISO 2022-JP encoded instead of (I assume) Windows code page 1252? Just ignoring text within quotes doesn't cut it, because 0x22 is not always " in ISO 2022-JP. Can you enforce a specific input encoding? If not, can you reliably determine the encoding given?
â Fox
May 2 at 20:55
Why not use a Unicode escape?
â Ignacio Vazquez-Abrams
May 2 at 20:02
Why not use a Unicode escape?
â Ignacio Vazquez-Abrams
May 2 at 20:02
The inputs come from users either as a copy paste or a text file, so I'd like to avoid having to manually convert any extended ascii characters.
â Bernie Lenz
May 2 at 20:10
The inputs come from users either as a copy paste or a text file, so I'd like to avoid having to manually convert any extended ascii characters.
â Bernie Lenz
May 2 at 20:10
1
1
The issue isn't really the accented character; it's that the data encoding does not match the parse encoding. How would your system react if the input were, say, ISO 2022-JP encoded instead of (I assume) Windows code page 1252? Just ignoring text within quotes doesn't cut it, because 0x22 is not always " in ISO 2022-JP. Can you enforce a specific input encoding? If not, can you reliably determine the encoding given?
â Fox
May 2 at 20:55
The issue isn't really the accented character; it's that the data encoding does not match the parse encoding. How would your system react if the input were, say, ISO 2022-JP encoded instead of (I assume) Windows code page 1252? Just ignoring text within quotes doesn't cut it, because 0x22 is not always " in ISO 2022-JP. Can you enforce a specific input encoding? If not, can you reliably determine the encoding given?
â Fox
May 2 at 20:55
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
1
down vote
Try replacing the character ä
with its UTF8 encoding u00e4
:
curl -s -X POST -H "Content-Type: application/json" -H "Accept: application/json" -d '"testField":"u00e4"' https://someurl..
The inputs come from users either as a copy paste or via a text file, so I'd like to avoid having to manually convert any extended ascii characters.
â Bernie Lenz
May 2 at 20:10
Then you'll need to use a Unicode encoding library of some kind. There are ones available in most popular languages (Python, PHP), so just choose your favorite...
â jayhendren
May 2 at 20:18
If you want to stick to bash, you can probably use jq. For instance:echo '"testField":"u00e4"' | jq . -a
yields"testField": "u00e4"
.
â jayhendren
May 2 at 20:24
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
Try replacing the character ä
with its UTF8 encoding u00e4
:
curl -s -X POST -H "Content-Type: application/json" -H "Accept: application/json" -d '"testField":"u00e4"' https://someurl..
The inputs come from users either as a copy paste or via a text file, so I'd like to avoid having to manually convert any extended ascii characters.
â Bernie Lenz
May 2 at 20:10
Then you'll need to use a Unicode encoding library of some kind. There are ones available in most popular languages (Python, PHP), so just choose your favorite...
â jayhendren
May 2 at 20:18
If you want to stick to bash, you can probably use jq. For instance:echo '"testField":"u00e4"' | jq . -a
yields"testField": "u00e4"
.
â jayhendren
May 2 at 20:24
add a comment |Â
up vote
1
down vote
Try replacing the character ä
with its UTF8 encoding u00e4
:
curl -s -X POST -H "Content-Type: application/json" -H "Accept: application/json" -d '"testField":"u00e4"' https://someurl..
The inputs come from users either as a copy paste or via a text file, so I'd like to avoid having to manually convert any extended ascii characters.
â Bernie Lenz
May 2 at 20:10
Then you'll need to use a Unicode encoding library of some kind. There are ones available in most popular languages (Python, PHP), so just choose your favorite...
â jayhendren
May 2 at 20:18
If you want to stick to bash, you can probably use jq. For instance:echo '"testField":"u00e4"' | jq . -a
yields"testField": "u00e4"
.
â jayhendren
May 2 at 20:24
add a comment |Â
up vote
1
down vote
up vote
1
down vote
Try replacing the character ä
with its UTF8 encoding u00e4
:
curl -s -X POST -H "Content-Type: application/json" -H "Accept: application/json" -d '"testField":"u00e4"' https://someurl..
Try replacing the character ä
with its UTF8 encoding u00e4
:
curl -s -X POST -H "Content-Type: application/json" -H "Accept: application/json" -d '"testField":"u00e4"' https://someurl..
answered May 2 at 20:07
jayhendren
5,07721340
5,07721340
The inputs come from users either as a copy paste or via a text file, so I'd like to avoid having to manually convert any extended ascii characters.
â Bernie Lenz
May 2 at 20:10
Then you'll need to use a Unicode encoding library of some kind. There are ones available in most popular languages (Python, PHP), so just choose your favorite...
â jayhendren
May 2 at 20:18
If you want to stick to bash, you can probably use jq. For instance:echo '"testField":"u00e4"' | jq . -a
yields"testField": "u00e4"
.
â jayhendren
May 2 at 20:24
add a comment |Â
The inputs come from users either as a copy paste or via a text file, so I'd like to avoid having to manually convert any extended ascii characters.
â Bernie Lenz
May 2 at 20:10
Then you'll need to use a Unicode encoding library of some kind. There are ones available in most popular languages (Python, PHP), so just choose your favorite...
â jayhendren
May 2 at 20:18
If you want to stick to bash, you can probably use jq. For instance:echo '"testField":"u00e4"' | jq . -a
yields"testField": "u00e4"
.
â jayhendren
May 2 at 20:24
The inputs come from users either as a copy paste or via a text file, so I'd like to avoid having to manually convert any extended ascii characters.
â Bernie Lenz
May 2 at 20:10
The inputs come from users either as a copy paste or via a text file, so I'd like to avoid having to manually convert any extended ascii characters.
â Bernie Lenz
May 2 at 20:10
Then you'll need to use a Unicode encoding library of some kind. There are ones available in most popular languages (Python, PHP), so just choose your favorite...
â jayhendren
May 2 at 20:18
Then you'll need to use a Unicode encoding library of some kind. There are ones available in most popular languages (Python, PHP), so just choose your favorite...
â jayhendren
May 2 at 20:18
If you want to stick to bash, you can probably use jq. For instance:
echo '"testField":"u00e4"' | jq . -a
yields "testField": "u00e4"
.â jayhendren
May 2 at 20:24
If you want to stick to bash, you can probably use jq. For instance:
echo '"testField":"u00e4"' | jq . -a
yields "testField": "u00e4"
.â jayhendren
May 2 at 20:24
add a comment |Â
Why not use a Unicode escape?
â Ignacio Vazquez-Abrams
May 2 at 20:02
The inputs come from users either as a copy paste or a text file, so I'd like to avoid having to manually convert any extended ascii characters.
â Bernie Lenz
May 2 at 20:10
1
The issue isn't really the accented character; it's that the data encoding does not match the parse encoding. How would your system react if the input were, say, ISO 2022-JP encoded instead of (I assume) Windows code page 1252? Just ignoring text within quotes doesn't cut it, because 0x22 is not always " in ISO 2022-JP. Can you enforce a specific input encoding? If not, can you reliably determine the encoding given?
â Fox
May 2 at 20:55