src/Tools/jEdit/src/isabelle_encoding.scala
author wenzelm
Mon Dec 04 22:52:16 2017 +0100 (18 months ago)
changeset 67130 b023f64e0d16
parent 66457 9098c36abd1a
permissions -rw-r--r--
tuned signature;
wenzelm@43282
     1
/*  Title:      Tools/jEdit/src/isabelle_encoding.scala
wenzelm@36760
     2
    Author:     Makarius
wenzelm@36760
     3
wenzelm@36760
     4
Isabelle encoding -- based on UTF-8.
wenzelm@36760
     5
*/
wenzelm@34619
     6
wenzelm@34619
     7
package isabelle.jedit
wenzelm@34619
     8
wenzelm@34760
     9
wenzelm@36015
    10
import isabelle._
wenzelm@36015
    11
wenzelm@34625
    12
import org.gjt.sp.jedit.buffer.JEditBuffer
wenzelm@34619
    13
wenzelm@34619
    14
wenzelm@34738
    15
object Isabelle_Encoding
wenzelm@34624
    16
{
wenzelm@34625
    17
  def is_active(buffer: JEditBuffer): Boolean =
wenzelm@66457
    18
    buffer.getStringProperty(JEditBuffer.ENCODING).asInstanceOf[String] == "UTF-8-Isabelle"
wenzelm@62104
    19
wenzelm@67130
    20
  def perhaps_decode(buffer: JEditBuffer, s: String): String =
wenzelm@62104
    21
    if (is_active(buffer)) Symbol.decode(s) else s
wenzelm@34624
    22
}