Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

437
Views
Why in Intellij IDEA presence of ENQ/ESA unicode character in code cause it to show false multiple character literals error?

I was trying to fix some weird PDF Unicode remapping issues when I was stuck by this issue where adding an ENQ Unicode character to some part of the code prevents you from compiling the code and IDE will present you with what I think is a false alarm(error).

Consider this example of completely valid Kotlin code and let's call it Program A where unfortunately you can't see the actual characters here between apostrophes but believe me there's a character in there (if you copy this code into your IDE you can see those characters).

package yamin

fun main() {
    val foo = mutableListOf('')
    //val bar = mutableListOf('')
    println(foo)
}

However, you can see them in the picture.

Program A

But if you decide to compile this code somehow IDE fails to compile it and claims that there are 'Too many characters in a character literal' in line 4.

Program A false error

What is interesting is that the sheer presence of ENQ character even in a comment line prevents the IDE to compile this code and if you remove line 5, therefore, removing the presence of ENQ character then you can compile this code (let's call it Program B), observe:

Program B

Anyway if you decide to remove line 4 in Program A and uncomment line 5 then you can compile that code too (let's call it Program C).

enter image description here

So let's recap Program A is invalid and line 4 is the culprit of the invalidity but removing line 5 in that program which leaves us with Program B could be compiled successfully and this situation is repeated for Program C.

What am I missing here?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

It looks like a bug in Kotlin compiler, because the error happens even if the code is compiled with command-line: kotlinc enq.kt -include-runtime -d enq.jar

Also, this simple program gives different results on the playground (correct):

enter image description here

and locally (incorrect):

enter image description here

As a workaround you may use Unicode escape sequence syntax (at least for ENQ symbol):

enter image description here

Playground does the same thing when passing this code to the server, so the compiler gets sanitized code: enter image description here

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!