<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to add BOM to alert attached CSV file? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-add-BOM-to-alert-attached-CSV-file/m-p/672147#M112604</link>
    <description>&lt;P&gt;Hi &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/206061"&gt;@scelikok&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I am Chaehee working at Splunk Korea office as Sales Engineer-GSS Intern.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I'm experiencing a UTF-8 encoding error, just like the problem you experienced. I think I can modify the code like you advised, but my product is &lt;STRONG&gt;Splunk Cloud,&lt;/STRONG&gt; so I can't modify the code. Have you ever solved encoding problems with &lt;STRONG&gt;Splunk Cloud products&lt;/STRONG&gt; like me?&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 18 Dec 2023 07:54:35 GMT</pubDate>
    <dc:creator>ckang</dc:creator>
    <dc:date>2023-12-18T07:54:35Z</dc:date>
    <item>
      <title>How to add BOM to alert attached CSV file?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-add-BOM-to-alert-attached-CSV-file/m-p/306985#M57849</link>
      <description>&lt;P&gt;Hi experts,&lt;/P&gt;

&lt;P&gt;One of my customer wants to add UTF-8 BOM info to CSV files which are attached to email alerts.&lt;BR /&gt;
In case of CSV files which can be downloaded from Splunk Web UI, &lt;A href="https://answers.splunk.com/answers/128517/how-to-export-csv-with-bom.html"&gt;https://answers.splunk.com/answers/128517/how-to-export-csv-with-bom.html&lt;/A&gt; is the right answer. But this doesn't applied to csv files which are attached to email. &lt;/P&gt;

&lt;P&gt;Thank you in advance. &lt;/P&gt;</description>
      <pubDate>Sun, 27 Aug 2017 16:40:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-add-BOM-to-alert-attached-CSV-file/m-p/306985#M57849</guid>
      <dc:creator>kwchang_splunk</dc:creator>
      <dc:date>2017-08-27T16:40:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to add BOM to alert attached CSV file?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-add-BOM-to-alert-attached-CSV-file/m-p/306986#M57850</link>
      <description>&lt;P&gt;I'm having a ton of trouble understanding the question. You might get more answers if you could clarify it more. Break it down like I'm a little kid (not far from lol). &lt;/P&gt;</description>
      <pubDate>Fri, 08 Sep 2017 13:12:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-add-BOM-to-alert-attached-CSV-file/m-p/306986#M57850</guid>
      <dc:creator>sloshburch</dc:creator>
      <dc:date>2017-09-08T13:12:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to add BOM to alert attached CSV file?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-add-BOM-to-alert-attached-CSV-file/m-p/306987#M57851</link>
      <description>&lt;P&gt;CSV files attached to email are UTF-8 encoded in Splunk and there is no option to change the encoding. &lt;BR /&gt;
UTF-8 CSV files work well with spreadsheet editors such as Google sheet and Apple Numbers. Microsoft Excel added support for UTF-8 CSV files from Excel version 2019 onward; refer to &lt;A href="https://support.office.com/en-us/article/What-s-new-in-Excel-2019-for-Windows-5a201203-1155-4055-82a5-82bf0994631f"&gt;What's new in Excel 2019 for Windows&lt;/A&gt; | General improvements | CSV (UTF-8) support.&lt;/P&gt;

&lt;P&gt;Here is the workaround for the issue for Microsoft Excel (without CSV (UTF-8) support):&lt;BR /&gt;
1. Install Sublime Text.&lt;BR /&gt;
2. Open the CSV file using Sublime Text. &lt;BR /&gt;
3. Save the content using File &amp;gt; Save with Encoding &amp;gt; "UTF - 8 with BOM" to a new CSV file. &lt;BR /&gt;
4. Open the new CSV file using Excel.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Jan 2019 02:05:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-add-BOM-to-alert-attached-CSV-file/m-p/306987#M57851</guid>
      <dc:creator>keio_splunk</dc:creator>
      <dc:date>2019-01-15T02:05:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to add BOM to alert attached CSV file?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-add-BOM-to-alert-attached-CSV-file/m-p/563274#M100364</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;For anybody interested, I managed to add UTF8_BOM info into CSV files on email. &amp;nbsp;&lt;/P&gt;&lt;P&gt;Adding to lines into $SPLUNK_HOME/etc/apps/search/bin/sendemail.py &amp;nbsp;--&amp;gt;&amp;nbsp;generateCSVResults function.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;def generateCSVResults(results, escapeCSVNewline):
    if len(results) == 0:
        return ''

    header = []
    s = BytesIO()

    # BOM_UTF8 info fix for Excel compatibility
    import codecs
    s.write(codecs.BOM_UTF8)
    # BOM_UTF8 info fix end

    if sys.version_info &amp;gt;= (3, 0):
        t = TextIOWrapper(s, write_through = True, encoding='utf-8')
        w = csv.writer(t)
    else:
        w = csv.writer(s)

    if "_time" in results[0] : header.append("_time")
    if "_raw"  in results[0] : header.append("_raw")

    # for backwards compatibility remove all internal fields except _raw and _time
    for k in results[0].keys():
       if k.startswith("_") :
          continue
       header.append(k)

    w.writerow(header)
    # output each result's values
    for result in results:
        row = []
        for col in header:
            val = result.get(col,"")
            if isinstance(val, list):
                val = ' '.join(map(str,val))
            if (escapeCSVNewline):
                row.append(esc(val))
            else:
                row.append(val)

        w.writerow(row)
    return s.getvalue()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 14 Aug 2021 11:23:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-add-BOM-to-alert-attached-CSV-file/m-p/563274#M100364</guid>
      <dc:creator>scelikok</dc:creator>
      <dc:date>2021-08-14T11:23:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to add BOM to alert attached CSV file?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-add-BOM-to-alert-attached-CSV-file/m-p/672147#M112604</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/206061"&gt;@scelikok&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I am Chaehee working at Splunk Korea office as Sales Engineer-GSS Intern.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I'm experiencing a UTF-8 encoding error, just like the problem you experienced. I think I can modify the code like you advised, but my product is &lt;STRONG&gt;Splunk Cloud,&lt;/STRONG&gt; so I can't modify the code. Have you ever solved encoding problems with &lt;STRONG&gt;Splunk Cloud products&lt;/STRONG&gt; like me?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Dec 2023 07:54:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-add-BOM-to-alert-attached-CSV-file/m-p/672147#M112604</guid>
      <dc:creator>ckang</dc:creator>
      <dc:date>2023-12-18T07:54:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to add BOM to alert attached CSV file?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-add-BOM-to-alert-attached-CSV-file/m-p/674014#M112822</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/263421"&gt;@ckang&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Unfortunately, I don't think Splunk Cloud support will do this.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jan 2024 06:31:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-add-BOM-to-alert-attached-CSV-file/m-p/674014#M112822</guid>
      <dc:creator>scelikok</dc:creator>
      <dc:date>2024-01-12T06:31:05Z</dc:date>
    </item>
  </channel>
</rss>

