String. Replace. Translit problem (from Russian to English)

Hi,
need your help. I have a program that translit text from Russian language to English.
Examlpe:
Russian "Привет"
English "Privet"
The problem is when I am trying to replcae letter 'в' (Russian letter that sounds like an English v) to 'v', I have a strange ieroglifos like an 'y' with two dots at the head - number 152 in ASCII table (http://www.theasciicode.com.ar/extended-ascii-code/lowercase-letter-y-diaeresis-ascii-code-152.html).
Here is my code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include "stdafx.h"
#include <algorithm>
#include <iostream>
#include <string>
#include <locale>


using namespace std;

class Text;
class Line {
private:
	string str;
	int _Length;
	int Counter;

public:
	void GetLine();
	void Length();
	int Numbers();
	void Translit();		
	friend Text;
};

void Line::GetLine() {
	cout << "Enter your string: " << endl;
	getline (cin,str);
	cout << "Your String: " << str << endl;
};
void Line::Length() {
	cout << "Length: " << str.length() << endl;
};
void Line::Translit() {
	replace(str.begin(), str.end(), 'в', 'v');
	cout << "Translit: " << str << endl;
};



void main()
{
	setlocale( LC_ALL,"Russian" );

	Line Obj;
	Obj.GetLine();
	Obj.Length();
	Obj.Translit();

	system("pause");
	
}
You probably need to use the std::wstring class to properly handle your Russian characters.
Topic archived. No new replies allowed.