Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

telegraf.conf cannot be parsed if saved with notepad (UTF8 BOM) #1378

Closed
StianOvrevage opened this issue Jun 16, 2016 · 6 comments · Fixed by #1404
Closed

telegraf.conf cannot be parsed if saved with notepad (UTF8 BOM) #1378

StianOvrevage opened this issue Jun 16, 2016 · 6 comments · Fixed by #1404
Labels
bug unexpected problem or unintended behavior platform/windows

Comments

@StianOvrevage
Copy link
Contributor

When editing telegraf.conf with notepad the file is encoded in UTF-8 BOM and telegraf cannot get past the BOM and quits with:

Error parsing telegraf.conf, toml: line 1: parse error

So, it would be nice to have the config loader/parser accept UTF-8 BOM encoded files.

@Pomyk
Copy link

Pomyk commented Jun 22, 2016

@sparrc
Copy link
Contributor

sparrc commented Jun 22, 2016

Sorry @StianOvrevage but I have to agree with @Pomyk. I would recommend using Notepad++ which doesn't save with a BOM. It's a slippery slope to litter the codebase with special handling of little Windows-isms like this....

http://www.larshaendler.com/2015/01/20/remove-bom-with-notepad/

@sparrc sparrc closed this as completed Jun 22, 2016
@StianOvrevage
Copy link
Contributor Author

I understand from your point of view. But alas it is quite a hassle for Windows server operators to not be able to edit config files with any native Windows program, and I suspect to be a barrier to adoption and source of frustration.

@sparrc
Copy link
Contributor

sparrc commented Jun 22, 2016

fair enough......I can make it skip the first byte in certain cases :/

@sparrc sparrc reopened this Jun 22, 2016
@StianOvrevage
Copy link
Contributor Author

You rock! :D

@sparrc sparrc added the bug unexpected problem or unintended behavior label Jun 22, 2016
sparrc added a commit that referenced this issue Jun 22, 2016
sparrc added a commit that referenced this issue Jun 22, 2016
sparrc added a commit that referenced this issue Jun 23, 2016
chebrolus pushed a commit to chebrolus/telegraf that referenced this issue Jun 24, 2016
sparrc added a commit to influxdata/influxdb that referenced this issue Jun 24, 2016
Default windows text editor (Notepad) adds a BOM to the beginning of the
file. This needs to be trimmed otherwise we will get an "invalid toml"
error.

see influxdata/telegraf#1378
and http://utf8everywhere.org/#faq.boms
sparrc added a commit to influxdata/influxdb that referenced this issue Jun 24, 2016
Default windows text editor (Notepad) adds a BOM to the beginning of the
file. This needs to be trimmed otherwise we will get an "invalid toml"
error.

see influxdata/telegraf#1378
and http://utf8everywhere.org/#faq.boms
@stevebanik-ndsc
Copy link
Contributor

The toml error also appears if the file is edited in Powershell ISE with psedit. To get around the error in 1.5.2, I opened the .conf in Notepad++, converted to UTF-8 and saved the conf file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug unexpected problem or unintended behavior platform/windows
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants