The first safeguard against EPUB encoding errors is simple: never overwrite the only source while its decoding is uncertain. Choose recognizable text near the beginning, a proper name in the middle, and an end marker. Compare those checkpoints when the copy is opened and again after it has been saved and reopened. Package validation comes later; a structurally valid EPUB cannot repair text that was decoded incorrectly before export.
Quarantine the uncertain source
When a file opens with suspicious symbols, do not immediately choose another encoding and press Save. Preserve the original as evidence. Make a working duplicate with a date and attempt number, then record three expected checkpoints and the expected line layout. This gives every candidate decoder the same test.
The process works in any text editor that can reopen a file with an explicit encoding. Try one candidate at a time. A few readable Japanese characters are not enough. The heading, the middle proper noun, and the final marker must all agree, and the logical line breaks must remain plausible. Complete recovery of a file whose bytes are already damaged, OCR, and binary repair are different jobs; this article covers prevention during EPUB preparation.
Keeping the rejected candidate is useful. Label it with the failed checkpoint instead of deleting it. If the middle proper name failed under one decoder, that fact prevents a later editor from repeating the same guess and calling a different readable fragment success.
Make the declared UTF-8 error fail at admission
The cycle-six synthetic source was labeled as UTF-8 but physically encoded as Shift_JIS. A strict UTF-8 read produced 21 invalid-start or continuation-byte findings. This was a real failing input, not a clean control file. It was rejected before it could become EPUB package input.
Rune Studio's inspect text command independently identified the same working copy as Shift_JIS. That diagnosis located the problem at manuscript admission rather than inside an EPUB container. The original bytes were preserved, while the heading “夜の航路,” the middle checkpoint “高橋編集室,” and the ending “了” became the acceptance text for the repaired copy.
Separate Rune's tab response from serialization
The working copy was opened in a dedicated Rune Studio workspace, and the tab was set to UTF-8. That response described workspace state. In the development CLI used for this test, it did not by itself serialize the manuscript bytes, so the response was not accepted as a converted deliverable.
The correctly diagnosed Shift_JIS copy was then decoded strictly and serialized strictly as UTF-8. Rune reinspected the closed file as UTF-8. A second strict UTF-8 check found zero encoding errors, all three checkpoints matched, and the decoded text equaled the fixed expected specimen. The record therefore separates diagnosis, requested tab setting, physical serialization, and closed-file acceptance.
Rune Studio's product documentation also describes a red indication for characters that cannot be represented in the selected encoding and a pause in automatic saving while such characters remain. This run did not measure the warning color or timing. Its acceptance rule rests on the actual failing bytes and the repaired closed file.
Use three tests instead of one reassuring signal
Readable text is the first test, but it does not prove which encoding was written. A UTF-8 detection result is the second test, but it does not prove that a proper name survived unchanged. Warnings about unrepresentable characters are a third test. Keeping them separate prevents a green structural result or a familiar-looking paragraph from hiding a failure elsewhere.
If a required character cannot be represented, decide whether the project should change the target encoding or whether the text may be edited without changing its intended meaning. Do not silently remove a character to make a count agree. Record the old and new form, then have a person responsible for the manuscript accept the wording.
For a non-Rune workflow, a hexadecimal viewer or an independent encoding detector can provide the saved-byte check. What matters is that the result comes from the file after save, not from the selector that requested the save.
Pass the manuscript before testing the EPUB container
A valid ZIP package or well-formed XHTML cannot repair text that entered the workflow under the wrong decoder. The admission sheet therefore requires a zero-error UTF-8 result, three matching checkpoints, and the accepted file hash before EPUB generation begins.
Package inspection remains a separate row. Search exported XHTML for the same beginning, middle, and ending text, and return a missing checkpoint to source selection or conversion. Retailer acceptance and identical rendering in every reading application remain outside this source-encoding test.
Give each failure a different return path
If the three checkpoints are unreadable immediately after opening, close the duplicate without saving and try the next decoder. If the checkpoints are readable before save but wrong after reopening, investigate the selected encoding and output path. If the saved text is correct but a checkpoint is missing from the EPUB, verify which manuscript file and revision were selected for export.
This routing is faster than restarting the whole book. It also protects a correct source from repairs aimed at a package problem. Store rejected files with their reason and keep the successful candidate under a new name until the handoff is accepted.
Require five fields before exporting the real manuscript
The preflight record should contain the original hash, declared encoding, Rune-detected encoding, strict error count, three checkpoint readings, and the reopened result. In the controlled copy, the declared UTF-8 input was actually Shift_JIS: 21 strict UTF-8 errors were reduced to zero, and all three checkpoints matched after repair. The visual warning behavior was not measured and should not be marked as observed.
The next action for preventing EPUB encoding errors is to run that five-field check on a short duplicate. Close it, reopen the disk file, and only then use it as EPUB input. Treat readable prose, correct saved encoding, and a valid package as three independent successes. That separation keeps an encoding mistake from being sealed inside a clean container.


