Creating a class with a Cyrillic first symbol in the name leads to a SyntaxError in IRB
What happens: a syntax error occurs when a user writes
class Класс and hits 'Enter' in IRB.
What is expected to happen: the same thing that happens when you create a class in IRB with
class SomeClass line and hit 'Enter'.
How to reproduce:
- Run IRB.
class Классand hit 'Enter'.
This leads to a syntax error:
unexpected end-of-input, expecting end.
class Класс; endwill successfully create a class.
- It seems like having a Cyrillic symbol as the first letter in a class name causes this error:
class ZКлассworks fine.
Updated by an_vlad (Vladislav Andreev) about 2 months ago
shevegen (Robert A. Heiler) wrote:
Interesting that the first variant with "; end" works.
Does the code work for you in every way when you put it into a standalone .rb file and run this?
Yes, it does work when I run similar code in a file.
UPD I've just tried to run the same piece of code with a Greek name (
class Κατηγορίας and then 'Enter') and it also didn't work inside the IRB session. So this issue is caused by any Unicode symbol taking the first place in the name of a class.
Updated by duerst (Martin Dürst) about 1 month ago
- Assignee set to keiju (Keiju Ishitsuka)
It is indeed the first letter that's relevant. Examples such as
(last letter of class name is Greek alpha) and
(only first letter is Latin, rest is Greek) work without problems.
The problem for me is that the traceback doesn't give any specific information.
I have assigned this issue to Keiju Ishitsuka, the creator of IRB. Hopefully we can get some help or hints from him.