Forum: Ruby nkf #guess1 and #guess2 on html files

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
unknown (Guest)
on 2006-03-23 10:09
(Received via mailing list)
may be i'm not using correctly nkf #guess1 but it gaves me return type 3
(suuposed to be UTF-8) for ISO-8859-1 encoded files.

it gaves me also 3 for UTF-8 encoded files ???

my code is simply :

NKF.guess1(string)

with string=<whole file content>

also sometimes guess1 disaggreed with guess2 ???

whare could i find a table giving the encoding versus returned values
???
YANAGAWA Kazuhisa (Guest)
on 2006-03-23 13:16
(Received via mailing list)
In Message-Id: <removed_email_address@domain.invalid>
removed_email_address@domain.invalid (Une b.ANivue) writes:

> may be i'm not using correctly nkf #guess1 but it gaves me return type 3
> (suuposed to be UTF-8) for ISO-8859-1 encoded files.
>
> it gaves me also 3 for UTF-8 encoded files ???

Unfortunately NKF is just for Japanese tool, so you can't use it for
general code conversion / guessing, I think.
unknown (Guest)
on 2006-03-23 13:53
(Received via mailing list)
YANAGAWA Kazuhisa <removed_email_address@domain.invalid> wrote:

>
> Unfortunately NKF is just for Japanese tool, so you can't use it for
> general code conversion / guessing, I think.

ok, fine, i need just a tool in order to discriminate between ISO-8859-1
and UTF-8 (as a first step) without using the meta content-type charset
in the html file, which isn't reliable, for example a Ruby Cocoa site
(<http://www.rubycocoa.com/the-rubification-of-rtw>) says it's
ISO-8859-1 encoding (in the meta tag) but it is in fact UTF-8 (said by
Firefox and text editor and also http headers...)
This topic is locked and can not be replied to.