encoding

Generated by tinox doc

tinox.core.encoding, bundled with the compiler and also available as a standalone tinox-central package.

Html escaping

import tinox.core.encoding
class Main
{
    fnc main() -> Int32
    {
        const comment: String = "<script>alert('hi')</script> & more"
        const safe: String = Encoding::htmlEncode(comment)
        println(safe)
        const restored: String = Encoding::htmlDecode(safe)
        println(restored)
        const bytes: List<Int64> = Encoding::toUtf8("hi")
        println(Encoding::fromUtf8(bytes))
        return 0
    }
}

fn tinoxBytesToString(bytes: List<Int64>) → String

class Encoding

Methods

fn toCharCode(s: String) → Int64
fn fromCharCode(code: Int64) → String
fn toUtf8(s: String) → List<Int64>
fn fromUtf8(codes: List<Int64>) → String
fn htmlEncode(s: String) → String
fn htmlDecode(s: String) → String