Azure / Azure/azure-cli

az rest fails to upload a file to an integration account if the file contains special latin characters i.e. ä

Open
#15,288 1 comment 0 reactions 1 assignee Claimed by @jiasli View on GitHub
feature-request rest
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

## Describe the bug

When trying to store an XML schema into an integration account using the `az rest` command and the management api, the schema fails to be uploaded if the schema contains latin special characters i.e. í or ä.

The same schema can be loaded into the integration account, by using the same management api and curl.

**Command Name**
`az rest --method PUT `

**Errors:**

`ValidationError: Bad Request({"error":{"code":"InvalidRequestContent","message":"The request content is not valid and could not be deserialized: 'Unable to translate bytes [E4] at index 538 from specified code page to Unicode.'."}})`

## To Reproduce:
Steps to reproduce the behavior.

- create a file similar to the following (the inclusion of äddress is the text which causes the failure)
```json
{
"properties": {
"schemaType": "Xml",
"metadata": {
"messageType": "http://schemas.test#test_schema"
},
"content": "\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n",
"contentType": "application/xml"
},
"location": "UK South",
"tags": {
"integrationAccountSchemaName": "test-account"
}
}
```
- Attempt to load the schema using the following command

```
az rest --method PUT --headers Content-Type='application/json; charset=utf-8'
--uri https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/integrationAccounts/$integrationAccountName/schemas/schema1?api-version=2019-05-01
--body @$requestBodyFile
```

## Expected Behavior

The schema is uploaded to the integration account

## Environment Summary
```
Windows-10-10.0.19041-SP0
Python 3.6.8
Installer: MSI

azure-cli 2.12.0

Extensions:
application-insights 0.1.8

```
## Additional Context

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.