Results 1 to 3 of 3

Thread: Apache change US-ASCII to UTF-8

  1. #1

    Default Apache change US-ASCII to UTF-8

    I have a website that I am trying to get an xml file to parse correctly to an email message. I need to have this xml file in UTF-8 encoding but it appears no matter what I try it still show up as US-ASCII. I am using the http://validator.w3.org to validate and this is the message I get.
    Warning: text/* type without a charset parameter seen. Defaulting to US-ASCII per section 3.1 of RFC 3023.
    http://site.site.com/file.xml
    Fatal Error: Input data does not conform to the input encoding. The input encoding was us-ascii.
    http://site.site.com/file.xml

    I create an .htaccess file with this inside but that still doesn't appear to help.'
    AddDefaultCharset utf-8
    IndexOptions +Charset=UTF-8
    AddCharset utf-8 .html .xml

    I have spent well over 4 hours trying to figure out what I need to do in order to get Apache to show this file as UTF-8 and not the ASCII format it appears to be using. What am I missing or what else do I need to do so this virtual host web directory or xml files are seen as UTF-8?

    Thanks!

  2. #2
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,384

    Default Re: Apache change US-ASCII to UTF-8

    I run openSUSE 31.1, but naybe this helps.

    As IMHO UTF-8 should bb the only charaset set used in all places, specialy my web site, I have:
    Code:
    AddDefaultCharset utf-8
    as in fact the fisrst statements in my default-server.conf.

    I also have in each page (might be superfluous):
    HTML Code:
    <head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    Also, when I use vi on my HTML files, vi reports:
    Code:
    :set                                                                                 
    --- Opties ---
      filetype=html     nomodeline            showmatch           ttyfast
      helplang=nl         ruler               syntax=html         ttymouse=xterm2
      backspace=indent,eol,start
      fileencoding=utf-8
      fileencodings=ucs-bom,utf-8,default,latin1
    Browsers report as their conclusion that the encoding is UTF-8.
    So this seems to work here.

    While this mainly is about the meta data about the file (which encoding it is in), please remind that a file containing only US-ASCII characters is as well a valid ASCII file as well as a valid UTF-8 file.
    Last edited by hcvv; 15-Aug-2016 at 08:23.
    Henk van Velden

  3. #3

    Default Re: Apache change US-ASCII to UTF-8

    Thanks for this information. It has been ages since I've messed with Apache on this level but realized that my .htaccess file wasn't being read since I had AllowOverride set to None. Silly me!.

    It is working now.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •