# 1.9 upper-case for constants?

**URL:** <https://www.ruby-forum.com/t/1-9-upper-case-for-constants/172978>\
**Category:** Ruby\
**Created:** [July 30, 2009, 7:17pm UTC](https://www.ruby-forum.com/t/1-9-upper-case-for-constants/172978 "2009-07-30T19:17:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![stickstone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/6f9a4e/32.png) [@stickstone](https://www.ruby-forum.com/u/stickstone)\
**Post date:** [July 30, 2009, 7:17pm UTC](https://www.ruby-forum.com/t/1-9-upper-case-for-constants/172978/1 "2009-07-30T19:17:47Z")

</div>

I’m posting this here for some advice on whether this is a bug, or  
intentional behaviour.

ruby 1.9.2-preview1 is quite capable of distinguishing Unicode  
upper-case characters. However this doesn’t seem to be used when  
deciding whether an identifier is a constant or a local variable.

> > SCHÃ–N = 1 # constant  
> > =\> 1
> 
> > ÃœBER = 2 # local variable!  
> > =\> 2
> 
> > self.class.constants.grep(/SCH|BER/)  
> > =\> [:SCHÃ–N]
> 
> > local\_variables.grep(/SCH|BER/)  
> > =\> [:ÃœBER]

I am not sure from the source code whether this is intentional or not.  
In parse.c it uses rb\_enc\_isupper which understands encodings:

```
    else if (rb_enc_isupper(m[0], enc)) {
        id = ID_CONST;
    }
    else {
        id = ID_LOCAL;

```

This is in rb\_intern3. And yet it is called from rb\_intern2 which says:

ID  
rb\_intern2(const char \*name, long len)  
{  
return rb\_intern3(name, len, rb\_usascii\_encoding());  
}

thereby ignoring the source encoding and saying always use ASCII rules.

Can someone confirm if this is the behaviour which is intended?
