Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

how do i make @ to work with Chinese username

2»

Answers

  • jeongweejeongwee Vanilla version 2.6 ✭✭

    But you also have to go to the lines that you've already changed in functions.general.php and class.format.php and change

    /i'

    (end of the line) to

     '/iu'

    that step not working also,and broke the site.

  • jeongweejeongwee Vanilla version 2.6 ✭✭

    these codes are same as the file....i didnt switch anything.

    if (!function_exists('ValidateUsernameRegex')) {
       function ValidateUsernameRegex() {
          static $ValidateUsernameRegex;
          if (is_null($ValidateUsernameRegex)) {
             $ValidateUsernameRegex = sprintf("[%s]%s",
                C("Garden.User.ValidationRegex","\d\w_"),
                C("Garden.User.ValidationLength","{3,20}"));
    
  • vrijvlindervrijvlinder Papillon-Sauvage MVP
    edited August 2013

    Ok start over, undo what you did and start over, you may need to change or add this function too, or try only the unicode that pertains to language characters

     Redefine ValidateUsername() function
    
    if (!function_exists('ValidateUsername')) {
       function ValidateUsername($Value, $Field = '') {
          if (preg_match('/(^[ ]|[ ]{2}|[ ]$)/', $Value)) return FALSE; //  Fail on leading, trailing or runs of spaces
          return ValidateRegex(
             $Value,
             '^([\p{L}\p{N}\p{Pd}\p{Pc}\p{Lm}\p{M}]{3,40}+)?$/si' //  Allow spaces and 40 char length
          );
       }
    }
    
    
     changing the Regex filter from ascii-only to Unicode,which will allow you to use any kind of letters from any language..
    
    you can also customize your filter to allow or disallow specific characters by adding or removing Unicode components (the "p{x}" components within the Regex filter). Here is a small list of what each of those components mean:
    
    \p{L}: any kind of letter from any language.
    \p{Lm}: a special character that is used like a letter. 
    \p{M}: a character intended to be combined with another character (e.g. accents, umlauts, enclosing boxes, etc.).
    \p{N}: any kind of numeric character in any script. 
    \p{Z}: any kind of whitespace or invisible separator. 
    \p{Pd} or \p{Dash_Punctuation}: any kind of hyphen or dash. 
    \p{Pc}: a punctuation character such as an underscore that connects words. 
    
    for a complete list of Unicode components, refer to this url:
    http://www.regular-expressions.info/unicode.html
    
  • jeongweejeongwee Vanilla version 2.6 ✭✭
    edited August 2013

    i have posted it here
    http://vanillaforums.cn/discussion/680/怎么让-支持中文#latest
    i think chuck911 will help me to solve it .

  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    excellent ! @chuck911 speaks chinese and is very bright let us know how it gets solved

  • R_JR_J Ex-Fanboy Munich Admin

    That's a great idea! The guys over there will surely have had the same problem.

  • jeongweejeongwee Vanilla version 2.6 ✭✭

    it has been sloved, thx all :)

  • boardwalkboardwalk New
    edited September 2014

    Hey.. @jeongwee‌ Why didn't you made description the way you solved it?

  • peregrineperegrine MVP
    edited September 2014

    @jeongwee siad this was the best answer.... :)

    http://vanillaforums.org/addon/chinesepreference-plugin just install this plugin !

    Chinese Preference 中文增强补丁 0.1b

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • boardwalkboardwalk New
    edited September 2014

    I am not Chinese but Korean trying to figure out Mentions+ setting for Korean. :smiley:

    However it was awfully hard to me... and suddenly I though,
    maybe I could get some hints from how Chinese or Japanese solved it.

    All I wanted to know is the specific way. Not that Chinese plugin (I can't read it lol)
    I am going to make new discussion about my problem. (or Private message to R_J)

    but Thank you though @peregrine‌

  • R_JR_J Ex-Fanboy Munich Admin

    I guess it would be best to start a new discussion using that link: http://vanillaforums.org/post/discussion?AddonID=1179

Sign In or Register to comment.