# Determining the current charset

**URL:** <https://www.ruby-forum.com/t/determining-the-current-charset/125323>\
**Category:** Ruby\
**Created:** [January 8, 2008, 7:12am UTC](https://www.ruby-forum.com/t/determining-the-current-charset/125323 "2008-01-08T07:12:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![trucker](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ecae2f/32.png) [@trucker](https://www.ruby-forum.com/u/trucker)\
**Post date:** [January 8, 2008, 7:12am UTC](https://www.ruby-forum.com/t/determining-the-current-charset/125323/1 "2008-01-08T07:12:55Z")

</div>

Hi all,

What’s the best way to determine the current charset, i.e., the value I  
need to give to Iconv as the ‘to’ encoding so that converted characters  
display correctly on the terminal?

My current best guess is: `locale -c LC_CTYPE|head -6|tail -1`.
