<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent posts to Bug - unicode decode error</title><link>https://sourceforge.net/p/cppheaderparser/discussion/837843/thread/cb53dff0/</link><description>Recent posts to Bug - unicode decode error</description><atom:link href="https://sourceforge.net/p/cppheaderparser/discussion/837843/thread/cb53dff0/feed.rss" rel="self"/><language>en</language><lastBuildDate>Tue, 29 Mar 2016 14:35:17 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/cppheaderparser/discussion/837843/thread/cb53dff0/feed.rss" rel="self" type="application/rss+xml"/><item><title>Bug - unicode decode error</title><link>https://sourceforge.net/p/cppheaderparser/discussion/837843/thread/cb53dff0/</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;Can you attach a file that demonstrates the issue please?&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Jashua Cloutier</dc:creator><pubDate>Tue, 29 Mar 2016 14:35:17 -0000</pubDate><guid>https://sourceforge.net4e48f906b55cda568a2dc298d629cd8f4cb515bf</guid></item><item><title>Bug - unicode decode error</title><link>https://sourceforge.net/p/cppheaderparser/discussion/837843/thread/cb53dff0/</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;Hello,&lt;br/&gt;
First of all, thank you very much for CppHeaderParser - a very useful tool. I have been using it over the past few days and came across an error in reading source files that may have utf-8 encoding:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;header = CppHeaderParser.CppHeader(self.path);
  File "/usr/local/lib/python3.5/site-packages/CppHeaderParser/CppHeaderParser.py", line 2094, in __init__
    headerFileStr = "".join(fd.readlines())
  File "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 69: ordinal not in range(128)
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;I changed the following at (roughly) line 2088 in CppHeaderParser.py:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;        if (len(self.headerFileName)):
                #fd = open(self.headerFileName)
                fd = open(self.headerFileName, encoding='utf-8')
                headerFileStr = "".join(fd.readlines())
                fd.close()
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;This seems to solve the issue, but I am not sure what methods need to be tested to ensure this doesn't cause other problems.&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Carlo M. M.</dc:creator><pubDate>Tue, 29 Mar 2016 08:35:02 -0000</pubDate><guid>https://sourceforge.net980ec1e5dfff4fe6e33ee2f5c5f018d96c5df5af</guid></item></channel></rss>