Change Charset Iso-8859-1 Rss Feed Css Hack

Posted on by  admin
Change Charset Iso-8859-1 Rss Feed Css Hack Average ratng: 5,5/10 2155 reviews
  1. Change Charset Iso-8859-1 Rss Feed Css Hack Tool
  2. Change Charset Iso-8859-1 Rss Feed Css Hacks

I have a page that contains a form. This page is served with content type text/html;charset=utf-8. I need to submit this form to server using ISO-8859-1 character encoding. Is this possible with Internet Explorer?

Setting accept-charset attribute to form element, like this, works for Firefox, Opera etc. but not for IE.

Edit: This form is created by server A and will be submitted to server B. I have no control over server B.

Supermoto tires. If a blog is using a non-UTF-8 charset then the data will potentially be stored incorrectly and any text will often end up garbled. For example, if your blog uses ISO-8859-1 and some text submitted via AJAX contains non-ASCII characters then they'll be stored in the database as UTF-8 double bytes rather than their ISO-8859-1 single byte equivalents.

If I set server A to serve content with charset ISO-8859-1 everything works, but I am looking a way to make this work without changes to server A's encoding. I have another question about setting the encoding in server A.

Community
Juha SyrjäläJuha Syrjälä
22.5k27 gold badges112 silver badges161 bronze badges

11 Answers

There is a simple hack to this:

Insert a hidden input field in the form with an entity which only occur in the character set the server your posting (or doing a GET) to accepts.

Example: If the form is located on a server serving ISO-8859-1 and the form will post to a server expecting UTF-8 insert something like this in the form:

IE will then 'detect' that the form contains a UTF-8 character and use UTF-8 when you POST or GET. Strange, but it does work.

Collin Anderson
9,7046 gold badges45 silver badges44 bronze badges
Trygve Lie
dgaspardgaspar

It seems that this can't be done, not at least with current versions of IE (6 and 7).

IE supports form attribute accept-charset, but only if its value is 'utf-8'.

The solution is to modify server A to produce encoding 'ISO-8859-1' for page that contains the form.

Juha SyrjäläJuha Syrjälä
22.5k27 gold badges112 silver badges161 bronze badges

I've got the same problem here. I have an UTF-8 Page an need to post to an ISO-8859-1 server.

Looks like IE can't handle ISO-8859-1. But it can handle ISO-8859-15.

So this worked for me, since ISO-8859-1 and ISO-8859-15 are almost the same.

ChristianChristian

If you have any access to the server at all, convert its processing to UTF-8. The art of submitting non-UTF-8 forms is a long and sorry story; this document about forms and i18n may be of interest. I understand you do not seem to care about international support; you can always convert the UTF-8 data to html entities to make sure it stays Latin-1.

Edward Z. YangEdward Z. Yang
20.2k16 gold badges69 silver badges92 bronze badges

Just got the same problem and I have a relatively simple solution that does not require any change in the page character encoding(wich is a pain in the ass).

Change Charset Iso-8859-1 Rss Feed Css Hack

For example, your site is in utf-8 and you want to post a form to a site in iso-8859-1. Just change the action of the post to a page on your site that will convert the posted values from utf-8 to iso-8859-1.

this could be done easily in php with something like this:

David Mongeau-PetitpasDavid Mongeau-Petitpas

For Russian symbols 'windows-1251'

When simply convert string to cp1251

dr.dimitrudr.dimitru

I am pretty sure it won't be possible with older versions of IE. Before the accept-charset attribute was devised, there was no way for form elements to specify which character encoding they accepted, and the best that browsers could do is assume the encoding of the page the form is in will do.

It is a bit sad that you need to know which encoding was used -- nowadays we would expect our web frameworks to take care of such details invisibly and expose the text data to the application as Unicode strings, already decoded..

pdcpdc

Looks like Microsoft knows accept-charset, but their doc doesn't tell for which version it starts to work..
You don't tell either in which versions of browser you tested it.

PhiLhoPhiLho
35.8k4 gold badges82 silver badges124 bronze badges

I seem to remember that Internet Explorer gets confused if the accept-charset encoding doesn't match the encoding specified in the content-type header. In your example, you claim the document is sent as UTF-8, but want form submits in ISO-8859-1. Try matching those and see if that solves your problem.

warpwarp
sth
172k44 gold badges251 silver badges338 bronze badges
turbopack

Not the answer you're looking for? Browse other questions tagged htmlinternet-explorerformsencodingiso-8859-1 or ask your own question.

I am using a hosting company and it will list the files in a directory if the file index.html is not there ,it uses iso-8859-1 as the default encoding.

If the server is Apache, is there a way to set UTF-8 as the default instead?

Update: Additionally I found out that it is actually using a DOCTYPE of HTML 3.2 and then there is not charset at all.. so it is not setting any encoding. But is there a way to change it to use UTF-8?

zero8
7932 gold badges8 silver badges19 bronze badges
太極者無極而生太極者無極而生
73.4k101 gold badges376 silver badges632 bronze badges

11 Answers

In httpd.conf add (or change if it's already there):

MartinodFMartinodF
7,1322 gold badges27 silver badges28 bronze badges

Add this to your .htaccess:

Or, if you have administrator rights, you could set it globally by editing httpd.conf and adding:

(You can use AddDefaultCharset in .htaccess too, but it won’t affect Apache-generated directory listings that way.)

Mathias BynensMathias Bynens
110k39 gold badges179 silver badges229 bronze badges

See AddDefaultCharset Directive, AddCharset Directive, and this article.

But I have to use Chinese characters now and then. Previously, I translated Chinese characters to Unicode code and include it in the document using the &# hack. But it is only useful for page having a few characters.

There is a better way to do that: encode the charset information in the filename, and apache will output the proper encoding header based on that. This is possible thanks to the AddCharset lines in the conf file, such as the line below:

conf/httpd.conf:

So if you have a file whose names ends in .html.utf8, apache will serve the page as if it is encoded in UTF-8 and will dump the proper character-encoding directive in the header accordingly.

Eugene YokotaEugene Yokota
74.8k39 gold badges186 silver badges285 bronze badges

In .htaccess add this line:

This is for those that do not have access to their server's conf file.It is just one more thing to try when other attempts failed.

As far as performance issues regarding the use of .htaccess I have not seen this. My typical page load times are 150-200 mS with or without .htaccess

What good is performance if your page does not render correctly. Most shared servers do not allow user access to the config file which is the preferred place to add a character set.

MisunderstoodMisunderstood
3,9741 gold badge10 silver badges20 bronze badges

Place AddDefaultCharset UTF-8 into /etc/apache2/conf.d/charset. In fact, it's already there. You just have to uncomment it by removing the preceding #.

andr
14.2k10 gold badges38 silver badges54 bronze badges

Change Charset Iso-8859-1 Rss Feed Css Hack Tool

Bjartur ThorlaciusBjartur Thorlacius

I'm not sure whether you have access to the Apache config (httpd.conf) but you should be able to set an AddDefaultCharset Directive. See:

Change charset iso-8859-1 rss feed css hack tool

Look for the mod_mime.c module and make sure the following is set:

or the equivalent Apache 1.x docs (http://httpd.apache.org/docs/1.3/mod/core.html#adddefaultcharset).

However, this only works when 'the response content-type is text/plain or text/html'.

You should also make sure that your pages have a charset set as well. See this for more info:

JonJon
45.9k28 gold badges117 silver badges147 bronze badges

Change Charset Iso-8859-1 Rss Feed Css Hacks

This is untested but will probably work.

In your .htaccess file put:

However, this will require mod_headers on the server.

eis
36.9k9 gold badges105 silver badges154 bronze badges
MiffTheFoxMiffTheFox
15.8k12 gold badges59 silver badges88 bronze badges

For completeness, on Apache2 on Ubuntu, you will find the default charset in charset.conf in conf-available.

Uncomment the line

David GlanceDavid Glance

Where all the HTML files are in UTF-8 and don't have meta tags for content type, I was only able to set the needed default for these files to be sent by Apache 2.4 by adding both directives:

hon2a
5,5323 gold badges34 silver badges48 bronze badges
AlexAlex
Change charset iso-8859-1 rss feed css hack free

Just a hint if you have long filenames in utf-8: by default they will be shortened to 20 bytes, so it may happen that the last character might be 'cut in half' and therefore unrecognized properly. Then you may want to set the following:

IndexOptions Charset=UTF-8 NameWidth=*

NameWidth setting will prevent shortening your file names, making them properly displayed and readable.

As other users already mentioned, this should be added either in httpd.conf or apache2.conf (if you do have admin rights) or in .htaccess (if you don't).

pstrykpstryk

Just leave it empty: 'default_charset' in WHM :::::: default_charset ='

p.s. - In WHM go --------) Home »Service Configuration »PHP Configuration Editor ----) click 'Advanced Mode' ----) find 'default_charset' and leave it blank ---- just nothing, not utf8, not ISO

grrowgrrow

Not the answer you're looking for? Browse other questions tagged apachecharacter-encodingapache-config or ask your own question.

Comments are closed.