{"uid":"cap_4XLSU2YNmsswfiT0Zjbdu","slug":"encoding-detect-84664d2d","name":"encoding-detect","description":"Detect whether hex-encoded bytes are ASCII, UTF-8, or UTF-16 with a BOM, by decode-validity and BOM presence (not statistical language detection).","url":"https://x402.agentindex.world/encoding/detect?utm_source=zero.xyz","method":"GET","headers":{},"bodySchema":{"type":"object","properties":{"hex_bytes":{"type":"string","title":"Hex Bytes"}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.002","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.002/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.002","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.002","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_iC_jB9i-KATUTR1Bvqx6x","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.002","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Detects whether hex-encoded bytes represent ASCII, UTF-8, or UTF-16 (with BOM) by testing decode validity and BOM presence","exampleAgentPrompt":"Can you check what character encoding these hex bytes use — EF BB BF 48 65 6C 6C 6F — and tell me if there's a BOM and whether they decode cleanly?","exampleUseCases":[{"title":"Validate file encoding before processing","prompt":"I have a hex dump of an uploaded file that starts with FF FE 00 48 — can you tell me whether it's UTF-16 with a BOM, UTF-8, or plain ASCII so I know how to decode it correctly?"},{"title":"Debug garbled text from network payload","prompt":"I'm getting garbled output when decoding a network payload. Here's the hex: 48 65 6C 6C 6F 20 57 6F 72 6C 64 — can you detect what encoding these bytes are in so I can figure out where things are going wrong?"},{"title":"Automated encoding check in a data pipeline","prompt":"Before I push this hex-encoded data chunk into the parser, I need to know if it's ASCII, UTF-8, or UTF-16 — can you run the encoding detection on 41 42 43 and confirm it's valid?"}],"resultDescription":"Returns the detected encoding type (ASCII, UTF-8, or UTF-16), whether a BOM is present, and whether the bytes decode validly — based on structural decode-validity checks and BOM detection rather than statistical language guessing.","failureModes":["Invalid hex string input returns an error (non-hex characters, odd-length string)","Empty hex_bytes input may return an error or undefined result","Ambiguous byte sequences (e.g. valid both as ASCII and UTF-8) may default to the more restrictive classification","No statistical or language-level detection — exotic encodings like Latin-1 or Shift-JIS are not identified","Payment failure or insufficient funds returns 402 before any processing occurs"],"whenToPreferThis":"Use this endpoint when you need a fast, deterministic structural check on hex-encoded bytes to classify them as ASCII, UTF-8, or UTF-16 — especially when BOM detection matters. Prefer this over statistical language detectors when you want decode-validity guarantees rather than probabilistic guesses. Ideal for data pipelines, file processing agents, or any workflow where you receive raw bytes in hex form and need to know the encoding before attempting to decode them.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-02T12:39:35.701Z","isFirstParty":false,"canonicalSlug":"encoding-detect-84664d2d"}