# Ignore BOM on CSV when sending bulk invitations

**URL:** https://meta.discourse.org/t/ignore-bom-on-csv-when-sending-bulk-invitations/62332
**Category:** Bug
**Created:** [9 Mayo, 2017 04:30 UTC](https://meta.discourse.org/t/ignore-bom-on-csv-when-sending-bulk-invitations/62332 "2017-05-09T04:30:40Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![barryvan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/barryvan/32/82635_2.png) [@barryvan](https://meta.discourse.org/u/barryvan)
#### Post date: [9 Mayo, 2017 04:30 UTC](https://meta.discourse.org/t/ignore-bom-on-csv-when-sending-bulk-invitations/62332/1 "2017-05-09T04:30:40Z")

</div>

When creating a CSV in Excel, it by default includes (what I think is) a BOM marker at the top of the file, to ensure that it’s parsed as UTF-8. Unfortunately Discourse doesn’t handle this (and doesn’t read the file as UTF-8!) so the first email address always fails with an error like this:

![](https://global.discourse-cdn.com/meta/original/3X/c/5/c52e974399dfcb42f37ac1101bab929d3c49ff2f.png)

(Note that the “j” is the first letter of the actual email address.)

I think Discourse should strip/ignore the BOM on CSVs – it’s probably pretty common that people would put these together in Excel, after all. 😉

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [9 Mayo, 2017 06:03 UTC](https://meta.discourse.org/t/ignore-bom-on-csv-when-sending-bulk-invitations/62332/2 "2017-05-09T06:03:01Z")

</div>

That might make sense @techapj I can confirm via hex editor, when Excel 2016 file is saved as CSV

```
a,b,c,d
e,f,g,h

```

there is the BOM marker by default:

 ![](https://global.discourse-cdn.com/meta/original/3X/8/d/8def61e10e87ac4d821765c2216c0d2f6a1313a6.jpg)

> **[Byte order mark](https://en.wikipedia.org/wiki/Byte_order_mark)**
>
> The byte-order mark (BOM) is a particular usage of the special Unicode character code, .mw-parser-output .monospaced{font-family:monospace,monospace}U+FEFF ZERO WIDTH NO-BREAK SPACE, whose appearance as a magic number at the start of a text stream can signal several things to a program reading the text:
> BOM use is optional. Its presence interferes with the use of UTF-8 by software that does not expect non-ASCII bytes at the start of a file but that could otherwise handle the text stream.
> Uni...

`UTF-8 EF BB BF`

---

<div class="post-metadata">

### Author: ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### Post date: [9 Mayo, 2017 06:28 UTC](https://meta.discourse.org/t/ignore-bom-on-csv-when-sending-bulk-invitations/62332/3 "2017-05-09T06:28:34Z")

</div>

I went to review the W3C page to double check my understanding that the BOMs were only needed for UTF-16 and UTF-32 because UTF-8 did not have big / little endian.  
With HTML5 things have changed a bit since I last visited the page.  
Older browsers could use …BE and …LE HTTP headers but now the only way is by reading the BOM  
tl;dr for UTF-8 yes strip the BOM

> **[The byte-order mark (BOM) in HTML](https://www.w3.org/International/questions/qa-byte-order-mark)**
>
> What is the byte-order mark, and what do I need to know about it when creating HTML?

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [9 Mayo, 2017 17:19 UTC](https://meta.discourse.org/t/ignore-bom-on-csv-when-sending-bulk-invitations/62332/4 "2017-05-09T17:19:59Z")

</div>

Fixed via:

[https://github.com/discourse/discourse/commit/e6e00253267008b17c760befbd852b5fdf998060](https://github.com/discourse/discourse/commit/e6e00253267008b17c760befbd852b5fdf998060)

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [9 Mayo, 2017 17:27 UTC](https://meta.discourse.org/t/ignore-bom-on-csv-when-sending-bulk-invitations/62332/5 "2017-05-09T17:27:56Z")

</div>


