CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-chardet

Character encoding detector for automatic detection of text encodings using occurrence analysis

84

0.98x
Overview
Eval results
Files

rubric.jsonevals/scenario-2/

{
  "context": "This criteria evaluates how well the engineer uses the chardet package to detect character encodings from binary file data. The focus is on proper usage of chardet's detect() or detectFileSync() methods to analyze file contents and return encoding names.",
  "type": "weighted_checklist",
  "checklist": [
    {
      "name": "Import chardet package",
      "description": "The solution imports the chardet package (e.g., `import chardet from 'chardet'` or `const chardet = require('chardet')`)",
      "max_score": 10
    },
    {
      "name": "Read file as binary",
      "description": "The solution reads the file as binary data using fs.readFileSync() to get a Buffer/Uint8Array, preserving encoding information. This check applies only if NOT using chardet.detectFileSync().",
      "max_score": 20
    },
    {
      "name": "Use chardet.detect()",
      "description": "The solution calls chardet.detect() method with the binary buffer to detect the encoding (e.g., `chardet.detect(buffer)`). Award full points if this method is used correctly, or if chardet.detectFileSync() is used instead (see next item).",
      "max_score": 40
    },
    {
      "name": "Handle null return",
      "description": "The solution properly handles the case where chardet.detect() or chardet.detectFileSync() returns null (when encoding cannot be determined) by returning null, 'Unknown', or similar appropriate value",
      "max_score": 15
    },
    {
      "name": "Return encoding name",
      "description": "The solution returns the detected encoding name string as provided by chardet (e.g., 'UTF-8', 'UTF-16LE', 'Shift_JIS', 'windows-1252') without modification",
      "max_score": 15
    }
  ]
}

Install with Tessl CLI

npx tessl i tessl/npm-chardet

tile.json