# Commas in username are not escaped during export

**URL:** https://meta.discourse.org/t/commas-in-username-are-not-escaped-during-export/47299
**Category:** Bug
**Created:** [July 14, 2016, 1:16pm UTC](https://meta.discourse.org/t/commas-in-username-are-not-escaped-during-export/47299 "2016-07-14T13:16:15Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![watchmanmonitor](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/watchmanmonitor/32/430970_2.png) [@watchmanmonitor](https://meta.discourse.org/u/watchmanmonitor)
#### Post date: [July 14, 2016, 1:16pm UTC](https://meta.discourse.org/t/commas-in-username-are-not-escaped-during-export/47299/1 "2016-07-14T13:16:15Z")

</div>

I just exported my user list, and the resulting CSV was broken when a name contained a `,`

Adding quotes around values which contain a `,` would help.

---

<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: [July 14, 2016, 7:29pm UTC](https://meta.discourse.org/t/commas-in-username-are-not-escaped-during-export/47299/2 "2016-07-14T19:29:55Z")

</div>

Oh this is definitely a bug can you add to your list @techapj? Also check for and escape comma in other fields where it can exist.

---

<div class="post-metadata">

### Author: ![lkramer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lkramer/32/83897_2.png) [@lkramer](https://meta.discourse.org/u/lkramer)
#### Post date: [July 18, 2016, 7:21pm UTC](https://meta.discourse.org/t/commas-in-username-are-not-escaped-during-export/47299/3 "2016-07-18T19:21:59Z")

</div>

Howdy @codinghorror. I just came here to report a very similar bug. When we export our users, sometimes the **name** field contains something like **Smith, Jeff** or **Some Company, Inc.** and it’s not wrapped in quotes in the csv so when you open the csv it gets all out of whack. Thanks!

---

<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: [July 18, 2016, 8:17pm UTC](https://meta.discourse.org/t/commas-in-username-are-not-escaped-during-export/47299/4 "2016-07-18T20:17:47Z")

</div>

It is more complex than expected but @techapj is working on it

> <https://stackoverflow.com/questions/4025831/creating-carriage-returns-in-csv-cell-via-php/4026152#4026152>

---

<div class="post-metadata">

### Author: ![lkramer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lkramer/32/83897_2.png) [@lkramer](https://meta.discourse.org/u/lkramer)
#### Post date: [July 18, 2016, 8:31pm UTC](https://meta.discourse.org/t/commas-in-username-are-not-escaped-during-export/47299/5 "2016-07-18T20:31:25Z")

</div>

OK great. Thanks for the reply! It’ll be handy to have this fixed.

---

<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: [July 19, 2016, 7:53am UTC](https://meta.discourse.org/t/commas-in-username-are-not-escaped-during-export/47299/6 "2016-07-19T07:53:05Z")

</div>

Fixed via:

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

---

<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: [July 19, 2016, 7:53am UTC](https://meta.discourse.org/t/commas-in-username-are-not-escaped-during-export/47299/7 "2016-07-19T07:53:59Z")

</div>


