advpl-encoding

Detect and preserve per-file encodings for ADVPL/TLPP source files.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/JoniPraia/plugadvpl --skill advpl-encoding
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: advpl-encoding
Source: https://github.com/JoniPraia/plugadvpl/tree/main/skills/advpl-encoding
Command: npx skills add https://github.com/JoniPraia/plugadvpl --skill advpl-encoding

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill prevents broken characters (mojibake like ç / ã) when Claude reads or edits ADVPL/TLPP source files that use mixed encodings across .prw/.prx (cp1252) and .tlpp (utf-8).

Core Features & Use Cases

  • Encoding detection & preservation: keeps the detected encoding per source instead of forcing a global normalization that can corrupt files.
  • Safe edit workflow for .prw/.prx: directs a stage/commit conversion flow to avoid re-writing cp1252 files as UTF-8 with replacement characters.
  • Runtime conversion guidance: specifies when to use ADVPL conversion functions (EncodeUTF8/DecodeUTF8/STRICONV) for REST/JSON and other cross-codepage boundaries.
  • Use Case: You ingest a legacy Protheus project where some .prw files show garbled accents in Read output; you want Claude to make correct edits without corrupting existing accents or causing AppServer UnicodeEncodeError.

Quick Start

Tell the AI: “Check encoding for the file FOO.prw in my plugadvpl index, then give me the correct stage/commit edit workflow to avoid corrupting existing accents.”

Frequently Asked Questions about advpl-encoding

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fix mojibake characters in ADVPL Protheus source files?

Fix mojibake in ADVPL Protheus files by detecting and preserving per-file encodings instead of forcing global normalization. This approach prevents broken characters when reading or editing mixed cp1252 (.prw/.prx) and utf-8 (.tlpp) source files.

Why does Claude show garbled accents when reading .prw files in a legacy Protheus project?

Garbled accents appear in .prw files because they typically use cp1252 encoding, which gets misinterpreted during read operations. Preserving the detected encoding per source file ensures correct edits without corrupting existing accents or causing AppServer UnicodeEncodeError.

What is the correct workflow to edit cp1252 ADVPL files without corrupting existing accents?

The correct workflow uses a stage/commit conversion flow designed to avoid re-writing cp1252 files as UTF-8 with replacement characters. This safe editing process maintains the original encoding integrity of .prw and .prx files throughout modifications.

When should I use EncodeUTF8 or DecodeUTF8 in ADVPL REST JSON integrations?

Use EncodeUTF8, DecodeUTF8, or STRICONV functions when crossing codepage boundaries in ADVPL REST and JSON integrations. These runtime conversion functions handle transitions between internal Protheus encodings and external UTF-8 endpoints to prevent data corruption.

Can I normalize all .tlpp and .prw Protheus files to a single encoding during ingest?

You should not force a global normalization across mixed Protheus files because it corrupts data by ignoring per-file encodings. The recommended approach enforces a preserve-by-default policy, keeping .tlpp files as utf-8 and .prw files as cp1252 to maintain source integrity.