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

Strip bom from message #2351

Merged
merged 1 commit into from
Sep 2, 2016
Merged

Strip bom from message #2351

merged 1 commit into from
Sep 2, 2016

Conversation

ruflin
Copy link
Member

@ruflin ruflin commented Aug 23, 2016

Reading a file with a bom included the bom with the first event. This change removes the bom part from the first event in case it exists.

  • Tests for utf-8 and utf-16 added

Closes #1349

@ruflin ruflin added in progress Pull request is currently in progress. Filebeat Filebeat labels Aug 23, 2016
@ruflin ruflin added the discuss Issue needs further discussion. label Aug 23, 2016
@@ -20,6 +22,10 @@ func (p *StripNewline) Next() (Message, error) {

L := message.Content
message.Content = L[:len(L)-lineEndingChars(L)]

// Strip BOM
message.Content = bytes.Trim(message.Content, "\xef\xbb\xbf")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the BOM sequence can only be at start of file/stream. Should/Must not in between. What about utf-32 bom?

@ruflin ruflin added review and removed discuss Issue needs further discussion. in progress Pull request is currently in progress. labels Aug 31, 2016
@ruflin ruflin changed the title [WIP] Strip bom from message Strip bom from message Sep 1, 2016
Reading a file with a bom included the bom with the first event. This change removes the bom part from the first event in case it exists.

* Tests for utf-8 and utf-16 added

Closes elastic#1349
@tsg
Copy link
Contributor

tsg commented Sep 1, 2016

Nice! Easier than I would have thought. I let @urso have a look as well.

@andrewkroh
Copy link
Member

LGTM

@tsg tsg merged commit 8d6fcbf into elastic:master Sep 2, 2016
@monicasarbu monicasarbu deleted the bom8-fix branch September 5, 2016 10:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants