Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTML files need explict charset #42

Open
petermr opened this issue May 12, 2016 · 5 comments
Open

HTML files need explict charset #42

petermr opened this issue May 12, 2016 · 5 comments
Assignees

Comments

@petermr
Copy link
Member

petermr commented May 12, 2016

Even though the HTML files are output with encoding = "UTF-8" it appears that the browsers need this specified in a meta tag:

<head>
<meta charset="UTF-8"/>
</head>
@petermr petermr self-assigned this May 12, 2016
@tarrow
Copy link
Contributor

tarrow commented May 12, 2016

I just edited your markdown. Think github has changed how they handle three back ticks on one line

@tarrow
Copy link
Contributor

tarrow commented May 12, 2016

Also, I'm not sure since I haven't dug around but this is probably also an issue in ami (for the dataTables output). Or possibly the code that actually does this is in cmine.

@petermr
Copy link
Member Author

petermr commented May 12, 2016

Unfortunately I think any code that writes HTML has to do this.

    public void testReadCSV() throws Exception {
        File tableFile = new File(NormaFixtures.TEST_TABLE_DIR, "table.csv");
        HtmlTable table = CSVTransformer.createTable(tableFile);
        HtmlHtml html = new HtmlHtml();
        html.ensureHead().setUTF8Charset("");
        html.ensureBody().appendChild(table);
        XMLUtil.debug(html, new File("target/table/table.html"), 1);
    }

works.
So YOU have to remember the creation of HtmlHtml with head and charset.

I suppose we could have:

HtmlHtml html = HtmlHtml.createUTF8Html();

might work.

@tarrow
Copy link
Contributor

tarrow commented May 12, 2016

addUTF8Charset already exists in HtmlHead.

Any reason we can't add this.head.addUTF8Charset() to ensureHead() in HtmlHtml?

@petermr
Copy link
Member Author

petermr commented May 12, 2016

Probably not. I don't like surprises but UTF-8 is hardly a surprise.It either has to be a default or there is only one way to do it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants