Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Setting text/javascript encoding to utf8 with Jetty 10.0.16

Thank you, Joakim - your second suggestion has worked well for me:

 webapps/root.xml 
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN"
<Configure class="org.eclipse.jetty.server.handler.ContextHandler">
    <Set name="contextPath">/</Set>
    <Set name="welcomeFiles">
        <Array type="string">
            <Item>index.html</Item>
        </Array>
    </Set>
    <Set name="handler">
        <New class="org.eclipse.jetty.server.handler.ResourceHandler">
            <Set name="resourceBase">/var/www/html/wordsbyfarber.com</Set>
            <Set name="directoriesListed">true</Set>
        </New>
    </Set>
    <Get name="mimeTypes">
        <Call name="addMimeMapping">
    <Arg>js</Arg>
    <Arg>text/_javascript_;charset=utf-8</Arg>
        </Call>
    </Get>
</Configure>

Now I get the following response headers and the file is displayed with correct international characters in the Microsoft Edge browser:

HTTP/1.1 200 OK
last-modified: Tue, 03 Oct 2023 09:52:40 GMT
content-type: text/_javascript_;charset=utf-8
accept-ranges: bytes
vary: Accept-Encoding
content-encoding: gzip
server: Jetty(10.0.16)
connection: close

Best regards
Alex


Back to the top