Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

435
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda