1

I know how to read and write the language if i already know the language..For example here is the code to read and write russian language.

    public string FileRead(string filename, String Contents)
    {
        Contents = File.ReadAllText(filename,Encoding.GetEncoding("iso-8859-5"));
        return Contents;
    }
    public void FileWrite(string contents)
    {
        System.IO.File.WriteAllText("C:\\pathe.txt", contents,Encoding.UTF8);
    }

But my problem is that if i don't know the language then how can i detect that particular language automatically and then go to that particular code.(i.e in case of russian language,this code)

tshepang
  • 12,111
  • 21
  • 91
  • 136
soldiershin
  • 1,612
  • 1
  • 18
  • 29
  • I would say with great difficulty :) Unless the language is defined in the file somehow - anything you write will be a guess at best. Obviously, you can write code to detected Russian; but again not really as it may be Ukrainian, unless you further reduce it to character searching; but then again; you just mightn't have any words with Ukrainian specific characters (just an example). – Trent Jun 26 '13 at 06:18
  • I guessed that it wouldn't be that much simple but i still hoped that there would be an easy solution..:) – soldiershin Jun 26 '13 at 06:24

1 Answers1

1

I originally posted a link to detecting a language, but the real answer is actually here:

How to detect the language of a string?

hope this helps mate

Community
  • 1
  • 1
Trent
  • 2,909
  • 1
  • 31
  • 46