boostorg / boostorg/program_options

Problems with displaying long option description with cyrillic characters

Aperta
#24 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
C++
Stelle
136
Fork
117
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

I'm having some weird issues with displaying long option description that contains cyrillic characters:

```
[program_options]$ ./example --help
Allowed options:
-h [ --help ] print usage message
-f [ --enforcewrite ] enforcewrite Всегда перезаписывать
файлы в директории с
преобразованной
политикой безопасност▒

```
Note that weird symbols at the description end.
Here's the code to reproduce it:

```
#include
using namespace boost::program_options;

#include
using namespace std;

int main(int argc, char* argv[])
{
string s;

options_description desc("Allowed options");
desc.add_options()
("help,h", "print usage message")
("enforcewrite,f", value(&s)->value_name("enforcewrite"),
"Всегда перезаписывать файлы в директории с преобразованной политикой безопасности");

variables_map vm;
store(parse_command_line(argc, argv, desc), vm);

if (vm.count("help")) {
cout << desc << "\n";
return 0;
}
}
```

Appearance of such symbols seems to depend somehow on the length of the text string associated with the option (including option name, default value and it's description). In my case I worked around the problem by increasing the column width.

program option version is: 1.62.0
OS: CentOS 7.1

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Start with the options_description help output and the add_options call shown in the reproducer, then run the example with the long Cyrillic description. Trace how the streamed help text wraps the option and check that the output ends without replacement symbols when the column width is unchanged. The workaround of increasing the column width provides a comparison case.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
cpp
Ambito
cli
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.