2

Closed

Chinese character issue.

description

I am chinese. I use Blogsa with chinese characters. But when I create new category, new tag, it is does not work correctly. It's create the one successfully for the first time, when I create another one, it doesn't save the data into database and doesn't show me any error message.
I debuged the source code, and found that the problem appeared in the code file 'App_Code/Main/Functions.cs', the function is:
 
public static string CreateCode(String input)
{
    string[] pattern = new string[] { "[^a-zA-Z0-9-]", "-+" };
    string[] replacements = new string[] { "-", "-" };
    input = input.Trim();
    input = input.Replace("Ç", "C");
    input = input.Replace("ç", "c");
    input = input.Replace("Ğ", "G");
    input = input.Replace("ğ", "g");
    input = input.Replace("Ü", "U");
    input = input.Replace("ü", "u");
    input = input.Replace("Ş", "S");
    input = input.Replace("ş", "s");
    input = input.Replace("İ", "I");
    input = input.Replace("ı", "i");
    input = input.Replace("Ö", "O");
    input = input.Replace("ö", "o");
    //LVLL:注释掉,以避免无法输入中文的情况。如果input是中文,则下面的程序会将input都变成“-”
    //for (int i = 0; i < pattern.Length; i++)
    //{
    //    input = Regex.Replace(input, pattern[i], replacements[i]);
    //}
    return input;
}
 
If I input the Chinese words, the function 'CreateCode' always return '-'. So the newer Category or Tag can't be saved to database.
Closed Dec 20, 2011 at 9:46 PM by selcukermaya

comments

selcukermaya wrote Sep 16, 2010 at 9:34 PM

We will fix the new version. But you can like that;

//Current
string[] pattern = new string[] { "[^a-zA-Z0-9-]", "-+" };

//Replace With
//You Can add the Chinese Charachters...
string[] pattern = new string[] { "[^a-zA-Z0-9-注释掉以避免无法输入中文的情况。如果是中文则下面的程序会将都变成]", "-+" };

Good luck...

Best Regards...

wrote Sep 16, 2010 at 9:34 PM

wrote Sep 16, 2010 at 9:35 PM

wrote Dec 20, 2011 at 9:46 PM

wrote Feb 14, 2013 at 6:20 PM

wrote May 16, 2013 at 8:59 AM