ตัวระบุ Magic บิต: ข้อผิดพลาดที่พบบ่อยและวิธีแก้
รูปแบบความล้มเหลวที่เกิดขึ้นจริง ลักษณะที่เห็นในเอาต์พุต และวิธีแก้ที่ชัดเจน
วิธีใช้
- ตรวจสอบการเข้ารหัสอินพุตก่อน — BOM ที่ติดมาหรือการวางที่ไม่ใช่ UTF-8 จะทำให้ผลลัพธ์เสียก่อนเครื่องมือเริ่มทำงาน
- มองหาการตัดทอนแบบเงียบ หากความยาวเอาต์พุตเป็นเลขกลมอย่างน่าสงสัย แสดงว่ามีบางอย่างถูกตัดออก
- ยืนยันว่าตัวเลือกที่คุณเปลี่ยนคือสิ่งที่งานต้องการ ค่าเริ่มต้นที่ลืมตั้งคือสาเหตุที่พบบ่อยที่สุดของผลลัพธ์ที่ดูสมเหตุสมผลแต่ผิด
- รันใหม่ด้วยอินพุตขั้นต่ำที่คุณตรวจด้วยมือได้ แล้วจึงใส่ข้อมูลจริงกลับเข้าไป
ตัวอย่าง
The PNG signature followed by the start of its IHDR chunk.
ข้อมูลเข้า
89504E470D0A1A0A0000000D49484452
ข้อมูลออก — ผลลัพธ์
Bytes: 89 50 4E 47 0D 0A 1A 0A ASCII: .PNG.... Detected: PNG image Signature matched: 89504E470D0A1A0A → PNG image Detection is by file signature, not by extension — this is how servers should validate uploads, since a client can rename anything to .png.
รัน
คำอธิบาย
Identify a file type from its signature bytes rather than its extension — the safe way to validate uploads.
เครื่องมือที่เกี่ยวข้อง
ตัวแปลงไฟล์ to Base64Encode any local file to Base64 — nothing is uploaded.Base64to ไฟล์ DownloaderDecode Base64 back into the original file.ตัวตรวจสอบไฟล์แฮชMD5/SHA-1/SHA-256/SHA-512 of any file, computed locally.ไฟล์ MetadataViewerInspect name, MIME type, size and modification time.ตัวบรรจุไฟล์ to ZIPBundle multiple files into a ZIP archive locally.ตัวเข้ารหัส Base64Encode text, JSON, URLs or files to Base64, standard or URL-safe.