How to escape/encode characters in .htaccess RewriteRule

I want the Accept-Language header to be available in JavaScript, therefore in my .htaccess I set the following rule:

RewriteRule .* - [CO=HTTP-Accept-Language:%{HTTP:Accept-Language}:%{HTTP_HOST}:0:/]

This works, but not as anticipated.

The cookie is set as following:

Set-Cookie: HTTP-Accept-Language=en-US,en;q=0.9; path=/; domain=XXXXXX.XX

Since the cookie value contains ; character, JavaScript's document.cookie trims this value to


How can I force RewriteRule to escape\encode deliminator characters (; and space) to ensure that the entire cookie value is properly recorded?

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum