9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
[parent not found: <<df49a7370910190732i526a15b6o6d2822cd2d14bff0@mail.gmail.com>]
[parent not found: <<fe41879c0910190300l51480646pf9630e90c6f30207@mail.gmail.com>]
* Re: [9fans] utf-8 text files from httpd
@ 2009-10-19  9:05 Eris Discordia
  0 siblings, 0 replies; 15+ messages in thread
From: Eris Discordia @ 2009-10-19  9:05 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

The decision whether to open in place or save to disk based on MIME type is
up to the browser. For example, I set my browsers to ask to save to disk
application/pdf documents (rather than opening them with Adobe Acrobat's
problem plugin). A MIME type of text/plain (without any specification of
encoding) is correct (and expected by any mainstream browser) for text
files. Opera opens those by default but can be set to do any one of a
variety of tasks when encountering text/plain. All mainstream browsers also
include encoding autodetection routines which may or may not fail depending
on your file's contents. All mainstream browsers also allow you to select
an encoding to decode and view your document in.

Assuming the right bytes arrive at your client it is always possible to
read the file in the right encoding. The encoding specified in response
header has no say in the bytes that are transmitted.

If your "any browser" includes Opera try Preferences > Advanced > Downloads
> (Uncheck "Hide file types opened with Opera") > Quick Search text/plain >
Edit > Action: Open with Opera (if the setting has been altered). Then
retry visiting your remote file. Even if response header contains the wrong
encoding (ISO-8859-1, EUC-KR, whatever) or no encoding specification at all
Opera should retrieve the document and display it. If the display is wrong,
try View > Encoding > Unicode > UTF-8.

The behavior you describe of "having to download the file" and "characters
being garbled" is not "any browser" sort of behavior. Neither Opera, nor
Firefox, nor Chrome display such behavior for the example I have supplied
below.

If all else fails... why not wget -S [URI] and check (and probably post)
the response header?

This resource, for example:

<http://www.phrack.org/issues.html?issue=66&id=3&mode=txt>

results in this response header:

>   HTTP/1.1 200 OK
>   Date: Sun, 18 Oct 2009 10:45:56 GMT
>   Server: Apache
>   X-Powered-By: PHP/5.2.8-pl2-gentoo
>   Cache-Control: no-store, no-cache
>   Connection: close
>   Content-Type: text/plain

And there's no problem whatsoever with its display in either Opera, Chrome,
or Firefox. Opera Info Panel says, by the way:

> Encoding (used by Opera):
> - not supplied - (windows-1252)




--On Sunday, October 18, 2009 20:34 -0400 Akshat Kumar
<akumar@mail.nanosouffle.net> wrote:

> I'm trying to put up a plain text file containing UTF-8
> characters from httpd, but when viewing it from any
> browser, it comes off as an ASCII file that needs to
> be downloaded (so, those characters are garbled).
> Is this due to some behaviour of httpd?
>
> ak
>



^ permalink raw reply	[flat|nested] 15+ messages in thread
[parent not found: <<A6127A93-8E78-4E11-9284-56A16D2A2093@ar.aichi-u.ac.jp>]
[parent not found: <<fe41879c0910181734l6363baebsa896bda992d690@mail.gmail.com>]
* [9fans] utf-8 text files from httpd
@ 2009-10-19  0:34 Akshat Kumar
  2009-10-19  1:39 ` andrey mirtchovski
  2009-10-19  2:16 ` Kenji Arisawa
  0 siblings, 2 replies; 15+ messages in thread
From: Akshat Kumar @ 2009-10-19  0:34 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

I'm trying to put up a plain text file containing UTF-8
characters from httpd, but when viewing it from any
browser, it comes off as an ASCII file that needs to
be downloaded (so, those characters are garbled).
Is this due to some behaviour of httpd?

ak



^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2009-10-19 17:36 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <<df49a7370910190649k3179f0b1r4c877d5ca72af232@mail.gmail.com>
2009-10-19 13:55 ` [9fans] utf-8 text files from httpd erik quanstrom
2009-10-19 14:32   ` roger peppe
2009-10-19 17:36     ` lucio
     [not found] <<df49a7370910190732i526a15b6o6d2822cd2d14bff0@mail.gmail.com>
2009-10-19 14:50 ` erik quanstrom
     [not found] <<fe41879c0910190300l51480646pf9630e90c6f30207@mail.gmail.com>
2009-10-19 13:14 ` erik quanstrom
2009-10-19 13:49   ` roger peppe
2009-10-19  9:05 Eris Discordia
     [not found] <<A6127A93-8E78-4E11-9284-56A16D2A2093@ar.aichi-u.ac.jp>
2009-10-19  4:46 ` erik quanstrom
     [not found] <<fe41879c0910181734l6363baebsa896bda992d690@mail.gmail.com>
2009-10-19  1:37 ` erik quanstrom
2009-10-19 10:00   ` Akshat Kumar
2009-10-19 12:45     ` Kenji Arisawa
  -- strict thread matches above, loose matches on Subject: below --
2009-10-19  0:34 Akshat Kumar
2009-10-19  1:39 ` andrey mirtchovski
2009-10-19  2:16 ` Kenji Arisawa
2009-10-19  3:35   ` Kenji Arisawa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).