Przejdź do treści
Biblioteka skilli
Programowanie · Budowanie i kod

encoding-roundtrip

/encoding-roundtrip

Edytuje pliki tekstowe w kodowaniach innych niż UTF-8, na przykład CP949, Shift_JIS czy Windows-1250, bez zmiany pozostałych bajtów.

Licencja
MIT
Ostatnia zmiana repozytorium
13.11.2026

Ocena i bezpieczeństwo

100/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść35 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
3
Skrypty
1
Komentarze HTML
0
Adresy URL w SKILL.md
0
Przestarzałość

Brak sygnałów. Repozytorium zmienione 13.11.2026, bez odwołań do wycofanych modeli i API.

Licencja

MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.

Co sprawdzić przed instalacją
  • 1 skrypt w paczce. Przejrzyj je przed instalacją, bo Claude może je uruchomić.

Skrypty: scripts/roundtrip.py

Co robi i kiedy

Edytuje pliki tekstowe w kodowaniach innych niż UTF-8, na przykład CP949, Shift_JIS czy Windows-1250, bez zmiany pozostałych bajtów.

Oryginalny opis (EN)

Edits text files that are not plain UTF-8 with LF (CP949, EUC-KR, Shift_JIS, GBK, Windows-1250/1251/1252, UTF-8 with BOM, CRLF or mixed line endings) byte-exactly. A bundled script applies a find/replace or line change in one call and writes the file back in its original encoding, BOM, per-line line endings and final newline, copies untouched lines as the original bytes, refuses characters the encoding cannot hold with the exact line, column and code point, and reports which files or lines use another encoding. Use when the user asks to change, add to or inspect a legacy-encoded, CRLF or BOM s

Jak działa

  1. Rules
  2. Change a file: one command
  3. Only look, do not change
  4. When the script says no
Sekcje z nagłówków SKILL.md, w oryginale · 60 linii, 644 słów
Podgląd SKILL.md
---
name: encoding-roundtrip
description: Edits text files that are not plain UTF-8 with LF (CP949, EUC-KR, Shift_JIS, GBK, Windows-1250/1251/1252, UTF-8 with BOM, CRLF or mixed line endings) byte-exactly. A bundled script applies a find/replace or line change in one call and writes the file back in its original encoding, BOM, per-line line endings and final newline, copies untouched lines as the original bytes, refuses characters the encoding cannot hold with the exact line, column and code point, and reports which files or lines use another encoding. Use when the user asks to change, add to or inspect a legacy-encoded, CRLF or BOM source, config or text file, when an edit is refused as not valid UTF-8, when a file shows replacement characters or garbled Korean, Japanese, Chinese or accented text, when a diff suddenly covers a whole file, or to list which files in a folder or repository are not plain UTF-8 or use CRLF or a BOM. Not for converting files to UTF-8 permanently or normalizing line endings.
license: MIT
compatibility: Python 3.10+ (standard library only). No network access.
---

# Edit legacy-encoded files without changing their bytes

Agents read and write UTF-8 with LF. On a CP949, Shift_JIS, BOM or CRLF file that corrupts text or rewrites every
line. The bundled script does the byte work. `scripts/roundtrip.py` below is relative to this skill's folder: use
its full path and run it from the user's folder with the file path as the user gave it. `--lang ko` or `--lang en`
picks the message language.

## Rules

- Only the script writes such a file. Never change it with Edit, Write, MultiEdit, `sed -i`, `perl -i`, `iconv`,
  `unix2dos` or `dos2unix`, and do not Read or `cat` it to see the text (that shows garbled bytes).
- Stop early: one `edit` call normally finishes the task. After it succeeds do not run `verify`, `status`,
  `inspect` or `git diff`, and do not explore other files. If the named file or folder does not exist, say so and stop.
- End your answer with the `ER-SUMMARY` line printed by the command that wrote the file or refused to, copied
  exactly as one line, then one or two plain sentences.

## Change a file: one command

```
python3 scripts/roundtrip.py edit FILE --old 'exact old text' --new 'new text'
python3 scripts/roundtrip.py edit FILE --append-line 'new last line'
python3 scripts/roundtrip.py edit FILE --set-line '12:the whole new text of line 12'
python3 scripts/roundtrip.py edit FILE --insert-after '3:a new line after line 3'
python3 scripts/roundtrip.py edit FILE --delete-line 7
```

- `edit` detects the encoding, applies the change and writes the file once. BOM, the line ending of every unchanged
  line and the final newline stay as they were; new lines get the file's usual ending.
- `--old` must match exactly once (add `--all` to change every match). Options may repeat and combine. Write
  `--old='-text'` when the text starts with `-`. `--insert-after '0:...'` inserts before line 1.
- Need to see the text first (a line number, a typo): run `inspect --text FILE` once, then `edit`.
- Many scattered changes: `open FILE` (the file becomes a UTF-8/LF working copy), change it with your normal tools,
  then `close FILE`, and paste the `close` summary line. A file left open stays UTF-8: finish with `close` or `abort FILE`.

## Only look, do not change

- One file ("which encoding", "which lines are garbled", "do not modify"): run `inspect FILE` once. Name the
  encoding and the line numbers in `mixed_encoding_lines` (joined by `+`), then stop.
- A folder or the repository ("which files are not UTF-8, have CRLF or a BOM"): run `scan FOLDER` once (`scan .`
  when no folder is named or the named one does not exist). Answer from its table; do not inspect files one by one.

## When the script says no

A non-zero exit means nothing was written. Show the error line and the `ER-SUMMARY` line as printed, then:

- `E_UNENCODABLE`: list every `U+XXXX at line:column` exactly as printed and propose replacements (`-` for an em
  dash, `[OK]` for a check mark). Do not remove, replace or escape the character yourself; use
  `--replace xmlcharref` or `--replace question` only after the user agrees. Reason `euc_kr_filler` in a file the
  user calls CP949: run the same command with `--encoding cp949`. Reason `ascii_only`: ask which encoding to use.
- `E_AMBIGUOUS`: do not guess; ask for the encoding, then repeat the command with `--encoding NAME`.
- `E_MIXED_ENCODING`: list the lines from the output and ask how to proceed.
- `E_NO_MATCH`, `E_MANY_MATCHES`: run `inspect --text FILE` once and retry with the exact or a longer `--old`.
- `E_BINARY`, `E_UNSUPPORTED`: do not edit the file as text.
- `E_ALREADY_OPEN`, `E_NOT_OPEN`, `E_STATE_MISMATCH`: a session from `open` is involved; follow the message. Use
  `--force` only when the message offers it and the user agrees.

`verify FILE` compares a result with the original later if the user asks. Codec pitfalls (CP949 versus EUC-KR,
Shift_JIS versus CP932, Windows-125x) are in references/encodings.md.
Pliki w paczce (3)
  • SKILL.md 5 KB
  • references/encodings.md 3 KB
  • scripts/roundtrip.py 104 KB

Wersje

W bazie nie ma innych skilli o nazwie encoding-roundtrip.

Migawka bazy z 13.11.2026 · wersja paczki e82961f16069 (skrót SHA-256 całej paczki)

Pobrania w ostatnich 30 dniach: 0 · ranking

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 100fixing-text-encodings
    Diagnozuje krzaczki w tekście (mojibake) i audytuje lub masowo konwertuje pliki w kodowaniach innych niż UTF-8, w tym CP1251, CP1252, KOI8-R i GBK, przez serwer MCP file-tools.
  • 100windows-agent-shell
    Naprawia problemy agenta kodującego na Windows: przepisywanie ścieżek w Git Bash, cytowanie PowerShell, kodowanie i CRLF.
  • 100safe-text-editing
    Pilnuje, by zmiany plików i argumentów nie gubiły znaków: cudzysłowy, ukośniki, kodowanie, CRLF i kody wyjścia. Przydaje się, gdy zapisany tekst wychodzi inaczej, niż zamierzono.
  • 90windows-shell-rules-en
    Stosuje zasady pracy na Windows: prostych nazw plików, zapisu UTF-8, ścieżek w cudzysłowie i właściwej powłoki.
  • 100wp-utf8-text
    Obsługuje UTF-8 i kodowanie tekstu we wtyczkach WordPress 6.9+: walidację, czyszczenie i odrzucanie niepoprawnych bajtów oraz granice XML, JSON i feedów.
  • 100edit-mcp
    Edytuje pliki lokalnie z dokładnością do linii i kolumny: zamienia tekst, usuwa linie, stosuje wiele zmian naraz i czyta zakresy z numerami.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.