# Should a gem set $KCODE in ruby 1.8 for others?

**URL:** <https://www.ruby-forum.com/t/should-a-gem-set-kcode-in-ruby-1-8-for-others/171336>\
**Category:** Ruby\
**Created:** [June 30, 2009, 8:25pm UTC](https://www.ruby-forum.com/t/should-a-gem-set-kcode-in-ruby-1-8-for-others/171336 "2009-06-30T20:25:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ghorner](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/a183cd/32.png) [@ghorner](https://www.ruby-forum.com/u/ghorner)\
**Post date:** [June 30, 2009, 8:25pm UTC](https://www.ruby-forum.com/t/should-a-gem-set-kcode-in-ruby-1-8-for-others/171336/1 "2009-06-30T20:25:35Z")

</div>

Hi,  
I recently got a request to make my gem utf-8 friendly:

> **[Issues · cldwalker/hirb](https://github.com/cldwalker/hirb/issues#issue/3)**
>
> A mini view framework for console/irb that's easy to use, even while under its influence. Console goodies include a no-wrap table, auto-pager, tree and menu. - Issues · cldwalker/hirb

since my gem involves calculating string lengths. For ruby 1.8 I need  
to use jcode’s jlength() to calculate this correctly but I’ll need to  
set $KCODE in order to use it. Is it considered intrusive to set  
$KCODE in a gem for others considering its global effect? If so, then  
I’ll probably just copy jcode’s jlength() into my code.

Thanks,  
Gabriel
