# Re: Premature end of regular expression with non-ascii chara

**URL:** <https://www.ruby-forum.com/t/re-premature-end-of-regular-expression-with-non-ascii-chara/99332>\
**Category:** Ruby\
**Created:** [January 31, 2006, 1:20pm UTC](https://www.ruby-forum.com/t/re-premature-end-of-regular-expression-with-non-ascii-chara/99332 "2006-01-31T13:20:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![K.Kosako](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/a87d85/32.png) [@K.Kosako](https://www.ruby-forum.com/u/K.Kosako)\
**Post date:** [January 31, 2006, 1:20pm UTC](https://www.ruby-forum.com/t/re-premature-end-of-regular-expression-with-non-ascii-chara/99332/1 "2006-01-31T13:20:36Z")

</div>

> Thank you both very much for the suggestions. First off I have  
> $KCODE=“u” in config/environment.rb (Rails). I have also tried to add it  
> into the class. But the error remained.

## This problem is quite unrelated to Oniguruma. I doubt that you are writing the script with ISO 8859-1.

K.Kosako

(In the following, kine is with accent.)

[kosako@noa test]$ file iso-8859-1.rb utf-8.rb  
iso-8859-1.rb: ISO-8859 text  
utf-8.rb: UTF-8 Unicode text  
[kosako@noa test]$ cat iso-8859-1.rb  
reg = /kine/u  
[kosako@noa test]$ cat utf-8.rb  
reg = /kine/u  
[kosako@noa test]$ ~/work/ruby-1.8.4/ruby iso-8859-1.rb  
iso-8859-1.rb:1: premature end of regular expression: /kin  
[kosako@noa test]$ ~/work/ruby-1.8.4/ruby utf-8.rb  
[kosako@noa test]$
