JavaRush
AI Academy
new
Promotion
Learning
Courses
Tasks
Quizzes
Games
Help
Schedule of nudges
Internship
Community
Users
Forum
Chat
Articles
Success stories
Activities
Reviews
Subscriptions
Light theme

Lectures

  • Reviews
  • About us
  • CS50
Start
Start learning
Start learning
  • My progress
  • Courses
  • Quest map
  • Lectures
  • Encoding: why “garbled text” appears

    Kotlin SELF
    44 level,0 lecture
    We break down why a “text file” is actually made of bytes ( ByteArray), how those bytes turn into strings ( String) via a decoding rule ( Charset), and why mismatched encodings produce “Привет” and “??????”. Using Kotlin/JVM examples, we learn to explicitly encode/decode via Charsets . UTF_8 and diagnose the issue by printing bytes in hex.
    Open
  • Encodings: UTF‑8 / UTF‑16 / ASCII

    Kotlin SELF
    44 level,1 lecture
    We break down how encodings turn text into bytes and back: what limits ASCII, why UTF‑8 became the de facto standard (ASCII compatibility and variable length), how UTF‑16 relates to the JVM (the Char type, String.length surprises with emoji), where the “extra bytes” in Charsets.UTF_16 come from, and what typical mistakes lead to “mojibake”.
    Open
  • Stabilize program behavior

    Kotlin SELF
    44 level,2 lecture
    We break down why the “default encoding” is a hidden dependency on the environment, and how to make I/O behavior reproducible: use an explicit Charset and Charsets . UTF_8, read and write text via readText/ writeText, work with ByteArray and manual decoding when needed, apply a streaming approach via bufferedReader/ use, and also assemble a mini-API so the encoding remains a “single source of truth”. At the end, we cover typical mistakes when working with encodings.
    Open
  • BOM — how to recognize it and why it breaks the file

    Kotlin SELF
    44 level,3 lecture
    We break down what BOM ( Byte Order Mark) is, why an invisible prefix at the beginning of a file leads to “magical” string mismatches (for example, == suddenly returns false), how to diagnose the problem by looking at bytes ( ByteArray, signature EF BB BF), and how to safely remove BOM at the byte and string levels (via '\uFEFF') without corrupting valid data.
    Open
  • Cleaning “dirty text”

    Kotlin SELF
    44 level,4 lecture
    We break down how to make text from a file predictable before parsing: read data as ByteArray, remove the UTF-8 BOM by its signature EF BB BF, decode via Charsets.UTF_8, normalize line breaks ( "\r\n", "\n", "\r"), and wrap everything into a function readCleanUtf8() so the parser works only with “clean” input.
    Open
Learn
  • Registration
  • Java course
  • Help with tasks
  • Pricing
Community
  • Users
  • Articles
  • Forum
  • Chat
  • Success stories
  • Activities
Company
  • About us
  • Contacts
  • Reviews
  • FAQ
  • Support
JavaRushJavaRush — is an interactive online course for learning Java programming from scratch. It contains 1200 practical tasks with one-click solution checking, the necessary minimum of theory on Java basics, and motivating features that help you complete the course: games, quizzes, interesting projects and articles on effective learning and the career of a Java developer.
Follow us
Язык интерфейса
Русский
English
Українська
"Programmers are not born" © 2026 JavaRush
MastercardVisa
"Programmers are not born" © 2026 JavaRush