Search code examples
variablesutf-8error-handlingcompiler-errorsvariable-names

Is it ok to use a non-English, foreign language variable name?


For me, English is too big a mountain. So whenever I use tools like Visual Studio 2017 (C ++), Unity 3D(C#), Visual Studio Code (html), Eclipse (java), and Android Studio, I've always assigned variables in my native language.

ex)

    int get넓이(int 가로, int 세로)
    {
        int square = 가로 * 세로;
        return square;
    }

However, many people advised not to use non-English variable names because they can 'cause errors'. But I have not experienced any errors yet.

I also contacted the Unity Game Engine customer center on this issue. And they answered me like this. "You can do this by going to [Visual Studio → File → Advanced Save Options], and then specify" Save as default encoding option "to UTF-8."

So, I wonder if there is an error when programming in a language other than English. because I have not experienced errors using non-English variable names. I have also contacted other community sites on this issue, but I have not seen anyone who experienced the issue.


Solution

  • It completely depends on what language you are programming in. For example, Python3 will support it (mostly, as long as it's Unicode), however, Python2 will not like it at all as it only supports ASCII.

    As with any code, if it makes it easier for you then do it. Just try your best to make it readable to others if it is going to be deployed to others. Just make sure your language fully supports Unicode.