# Bug in CGI::unescapeHTML?

**URL:** <https://www.ruby-forum.com/t/bug-in-cgi-unescapehtml/108591>\
**Category:** Ruby\
**Created:** [July 5, 2007, 6:06am UTC](https://www.ruby-forum.com/t/bug-in-cgi-unescapehtml/108591 "2007-07-05T06:06:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Esad\_H](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/3da27b/32.png) [@Esad\_H](https://www.ruby-forum.com/u/Esad_H)\
**Post date:** [July 5, 2007, 6:06am UTC](https://www.ruby-forum.com/t/bug-in-cgi-unescapehtml/108591/1 "2007-07-05T06:06:26Z")

</div>

Hi,

I think there’s a bug in CGI::unescapeHTML. Or am I doing something  
wrong?

$KCODE=‘u’  
CGI::unescapeHTML(“ã”)

will return “\343”, which according to my screaming mysql utf-8 encoded  
database is not a valid utf-8 sequence

The source of CGI::unescapeHTML reveals that all values \< 255 are simply  
translated to the ascii value using the value.chr

Greetings,

Esad
