UTF-8 validation in CLI

Bug #1971897 reported by Jordan Barrett
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Canonical Juju
Triaged
Wishlist
Unassigned

Bug Description

`juju config` employs UTF-8 validation on provided values, which was added in
https://github.com/juju/juju/pull/150
I believe the original reason for this was as follows. `juju config` supports reading configuration values from a file using an `@`. For example,
```
$ juju config <email address hidden>
```
will set the value for `key1` to the contents of `foo.txt`. In this case, it makes sense to check that the contents of `foo.txt` are valid UTF-8 before you set `key1`.

None of the other config commands use UTF-8 validation, and it seems to be used only sporadically throughout the CLI. Commands vary in whether they accept invalid UTF-8 sequences - some just accept it:
```
$ juju model-config ftp-proxy=$(printf %b '\xc3\x28')
$
```
```
$ juju deploy $(printf %b '\xc3\x28')
ERROR no charm was found at "\xc3("
```
```
$ juju bootstrap lxd $(printf %b '\xc3\x28')
Creating Juju controller "�(" on lxd/localhost
...
```

while some will complain:
```
$ juju config hello-juju port=$(printf %b '\xc3\x28')
ERROR value for option "port" contains non-UTF-8 sequences
```
```
$ juju add-model $(printf %b '\xc3\x28')
ERROR "\xc3(" is not a valid name: ...
```

It's worth thinking about whether this should be done more consistently:
 - Do we even need UTF-8 validation at all in `config`, `add-model`, etc?
 - Should we do this consistently across all the config commands, or even all commands?
i.e. when is UTF-8 validation appropriate/necessary, and when is it not needed?

Tags: cli feature
Revision history for this message
Vitaly Antonenko (anvial) wrote :

Hi, Jordan

That's an interesting issue, and I also think that UTF-8 validation should be done more consistently.

Qq: Will this issue affect negatively the juju client for Windows OSs?

Changed in juju:
importance: Undecided → Wishlist
tags: added: feature
tags: added: cli
Changed in juju:
status: New → Incomplete
status: Incomplete → Triaged
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.