M
M
Michael2012-06-07 15:44:48
Erlang
Michael, 2012-06-07 15:44:48

How to compare 2 Cyrillic characters?

Hello
Sorry for the noob question, 2nd day undertook to look at erlang.
The task in the following
is a string broken into characters and a certain algorithm for replacing characters is applied to it.
for example

func(CHAR)->
  case string:equal(CHAR,"о") of
    true
      -> "і";
    _Else
      -> CHAR
  end.

those. if the input character is "o" then I want to replace it with "i" if not, then no.
but I have string: equal - it doesn’t work, I think because of the encodings.
Only now I don't know how exactly to encode them?
PS Windows XP, source file in windows-1251, tried different source encodings, incl. UTF-8

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
Michael, 2012-06-07
@1099511627776

How would I figure out
the problem, as always in Windows,
because if I enter text in the console, it is in windows-1251 encoding and the result is also output in the same encoding, but the console itself interprets it as cp866.
Thank you for your attention

I
Ivan, 2012-06-07
@iSage

2> string:equal("ф", "ф").    
true

linux utf-8

M
Michael, 2012-06-07
@1099511627776

Used for breakdown

 string:sub_string(TEXT,POS,POS)

The problem is that now I'm not under Linux and therefore I have at least 3 encodings here 1 - UTF8 source code, CP866 - cmd console and CP1251.
PS To the minus ones: Probably the word Windows got on your nerves :) don't be so scared, it's just the name of the OS

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question