This page contains automated test results for code from O'Reilly's Ruby Cookbook. If this code looks interesting or useful, you might want to buy the whole book.
| Guessing a Document's Encoding (written by Mauro Cicio) | ||
|---|---|---|
| Code | Expected | Actual |
doc = %{<?xml version="1.0"?>
<menu tipo="specialitą" giorno="venerdģ">
<primo_piatto>spaghetti al ragł</primo_piatto>
<bevanda>frappč</bevanda>
</menu>}
require 'charguess'
CharGuess::guess doc |
"windows-1252" | "windows-1252" |
CharGuess::guess("\xA4\xCF") |
"EUC-JP" | "EUC-JP" |