Eric Hodel
10/14/2007 8:20:00 PM
On Oct 14, 2007, at 11:17 , 7stud -- wrote:
> eacute = ""
> eacute << 0xC3 << 0xA9 #eacute<< 195 << 169 ; or é
>
> p eacute
>
> --output:---
> "\303\251"
>
> That ouput is in octal--although there is no leading 0.
>
> 1) Where does that format come from, i.e. no leading 0?
> 2) Why is the output in octal and not hex?
Its at least as old as C. You'll probably have to ask some really
old timers for the answer.
$ cat octal.c
#include <stdio.h>
void main() { printf("\303\251\n"); }
$ gcc octal.c
octal.c: In function 'main':
octal.c:3: warning: return type of 'main' is not 'int'
$ ./a.out
é
> I looked up String#<< and it says it converts any Fixnum between 0-255
> to a character.
>
> 3) Using what character set?
ASCII. Its your terminal that controls how it gets displayed. My
terminal is set to UTF-8.
--
Poor workers blame their tools. Good workers build better tools. The
best workers get their tools to do the work for them. -- Syndicate Wars