Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is support for non-english characters common in programming languages? I mean, technically, I would think it is feasable, but I don't have any experience in anything other than english, so I don't know how common it is.

I know that there are non-english based programming languages, but can something like C#, C++, C, Java, or Python support non-english classes/methods/variables?

Example in go (url, http://play.golang.org/p/wRYCNVdbjC)

package main

import "fmt"

type 世界 struct {
    世界 string
}

func main() {
    fmt.Println("Hello, 世界")
    世界 := new(世界)
    世界.世界 = "hello world"
    fmt.Println(世界.世界)
}
share|improve this question
    
Possible duplicate: stackoverflow.com/questions/61615/… – Jeanne Boyarsky Dec 18 '12 at 4:32
    
What the hell are english characters? I know latin, greek, cyrillic characters, but english ones? – Ingo Dec 18 '12 at 15:12
    
There are a few English characters, like Þ (the capital letter Thorn). It's supported in some programming languages. – gnasher729 Jan 19 at 9:09
up vote 5 down vote accepted

Support for non-ASCII literals is present in virtually every modern language. That is, you can write something like japanese = "今日は世界" in Java, Python, Go, C#, Ruby, etc.

Support for non-ASCII identifiers, that is, things like 英語で = "Hello world" is also widespread. Languages that allow this, among others, are: Java, Python 3, but not 2 and 1, C#, etc.

Take a look at this lengthy list.

share|improve this answer

Erm... In the past I'd been programming in English but to support Asian language (mostly Chinese) in the UI.

For most of the coding, we use English. Only for the UI matter, i.e. label in Windows Forms, Row Header in GridView, text within html/aspx, we will use Chinese.

Thus, we won't code something like this...

type 世界 struct {
     世界 string
}

But will have things like

<b>你好, 欢迎你到来。</b>
share|improve this answer

For C#, the CLI Specification permits this

A source file is an ordered sequence of Unicode characters.

An identifier in a conforming program must be in the canonical format defined by Unicode Normalization Form C, as defined by Unicode Standard Annex 15. The behavior when encountering an identifier not in Normalization Form C is implementation-defined; however, a diagnostic is not required.

I've actually made a quick program almost entirely coded in Korean here out of curiosity. After having my code reviewed, me and my colleagues unanimously agreed that not only this makes the code harder to read, but particularly harder to write as it requires the coder to continuously toggle the character set between English/Non English.

I'm all for Unicode and internalization and stuff.. but for programming, I cannot really see the value of coding in other languages than English. Pragmatism is an important virtue to have as a programmer.

share|improve this answer

I think that this question is somewhat wider than "can I write Kanji in my favorite programming language".

For Java (and probably most other languages) Unicode is supported, and strings should be externalized to property files or similar. This lets you handle some common internationalization issues:

  • The messages are required in multiple languages (well that is what internationalization is about)
  • The position of parameters may vary between languages. For instance "The beautiful woman" in English may morph into the equivalent of "The woman beautiful" in other languages.
  • If your application supports multiple languages, then most developers will not be fluent in all the deployed languages. Again it is best if you support a single developnment language, and employ foreign language nationals to translate into other languages.
share|improve this answer

Although non-ASCII identifiers are supported in a large number of programming languages as 9000 and AhJian have said, it would be bad practice to use such and there are several reasons to do that.

The first one is that in some moment in feature a foreign coworkers that don't understand the language can join the the team, or the code may need to be reviewed by foreign experts or consultants. For them will be very hard to understand the code.

The second one, related to the first, is that you may not get help or review in StackExchange network if you don't replace the identifiers with english ones.

The third reason is that many of the programming terms are not translated in the particular language.

share|improve this answer

Almost all languages support non-ASCII characters directly or indirectly.

E.g. in Java you can directly give the non-ASCII characters; But in C# you have to use an escape character sequence i.e.\u00e1 for á.

Support for non-ASCII is also dependent on the text editor you are using.

share|improve this answer
1  
This is not what OP asked. – Tulains Córdova Dec 18 '12 at 17:48

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.