login/register

Snip!t from collection of Alan Dix

see all channels for Alan Dix

Snip
summary

This example sets the files unicode-example-intro.html, ...
<Files unicode-example-intro.html>
AddType "text/html; charset=UTF-8" html
</Files>
... .htaccess file, will have a charset encoding of "UTF-8".

To Serve Man
http://www.i18nguy.com/markup/serving.html

Categories

/Channels/techie/browser

[ go to category ]

For Snip

loading snip actions ...

For Page

loading url actions ...

This example sets the files unicode-example-intro.html, and unicode-example-ruby.html to UTF-8. The file char-count.html is set to Windows-1252 encoding. The file plane1-utf-16.html is set to UTF-16 encoding. The file plane1-utf-32.html is set to UTF-32 encoding.

<Files unicode-example-intro.html>
AddType "text/html; charset=UTF-8" html
</Files>
<Files unicode-example-ruby.html>
AddType "text/html; charset=UTF-8" html
</Files>
<Files char-count.html>
AddType "text/html; charset=WINDOWS-1252" html
</Files>
<Files plane1-utf-16.html>
AddType "text/html; charset=UTF-16" html
</Files>
<Files plane1-utf-32.html>
AddType "text/html; charset=UTF-32" html
</Files>
# end file with c/r

If all the files in the directory with the same suffix (e.g. "html") have the same encoding, then the "<Files ***>" and "</Files>" statements are not needed, and a single AddType statement will declare the encoding of all the files matching the suffix used in the statement. In the following example of the contents of a .htaccess file, the files with a suffix of html or txt in the same directory as the .htaccess file, will have a charset encoding of "UTF-8".

HTML

<p>This example sets the files <a href="../unicode/unicode-example-intro.html">unicode-example-intro.html</a>, and <a href="../unicode/unicode-example-ruby.html">unicode-example-ruby.html</a> to <b>UTF-8</b>. The file <a href="../unicode/char-count.html">char-count.html</a> is set to <b>Windows-1252</b> encoding. The file <a href="../unicode/plane1-utf-16.html">plane1-utf-16.html</a> is set to <b>UTF-16</b> encoding. The file <a href="../unicode/plane1-utf-32.html">plane1-utf-32.html</a> is set to <b>UTF-32</b> encoding. </p> <p class="code"> &lt;Files unicode-example-intro.html&gt; <br>AddType "text/html; charset=UTF-8" html <br>&lt;/Files&gt; <br>&lt;Files unicode-example-ruby.html&gt; <br>AddType "text/html; charset=UTF-8" html <br>&lt;/Files&gt; <br>&lt;Files char-count.html&gt; <br>AddType "text/html; charset=WINDOWS-1252" html <br>&lt;/Files&gt; <br>&lt;Files plane1-utf-16.html&gt; <br>AddType "text/html; charset=UTF-16" html <br>&lt;/Files&gt; <br>&lt;Files plane1-utf-32.html&gt; <br>AddType "text/html; charset=UTF-32" html <br>&lt;/Files&gt; <br># end file with c/r </p> <p>If all the files in the directory with the same suffix (e.g. "html") have the same encoding, then the "&lt;Files ***&gt;" and "&lt;/Files&gt;" statements are not needed, and a single <b>AddType</b> statement will declare the encoding of all the files matching the suffix used in the statement. In the following example of the contents of a <b>.htaccess</b> file, the files with a suffix of <b>html</b> or <b>txt</b> in the same directory as the .htaccess file, will have a charset encoding of "UTF-8". </p> <p class="code"> </p>