Skip to content

bug(encoding): non-ASCII characters in configuration file #737

Description

@Kristinita

1. Summary

If non-ASCII characters in HTML Tidy configuration file:

    I get extra warnings in console: Warning: replacing invalid character code N

2. Environment

  • Operation system:

    • Windows 10 Enterprise LTSB 64-bit EN (local)
    • Ubuntu 14.04.5 LTS (Travis CI)
  • HTML Tidy:

3. Configuration

See example configuration in SashaTidyDebugging branch of my demo repository.

Sasha__Tidy--NonASCIIInConfiguration.html:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
    <span></span>
</body>
</html>

tidy.conf:

# “”
#############
# HTML Tidy #
#############
# Validate and fix HTML files:
# http://www.html-tidy.org/
# Description:
# http://api.html-tidy.org/tidy/tidylib_api_next/index.html
# Options:
# http://api.html-tidy.org/tidy/quickref_next.html
# Configuration file format:
# http://api.html-tidy.org/tidy/tidylib_api_next/tidy_config.html
# No official configuration filename, I use common:
# https://github.com/search?utf8=%E2%9C%93&q=filename%3Atidy.conf&type=Code
#
# Doesn't print content of HTML files to console:
# http://api.html-tidy.org/tidy/quickref_next.html#markup
markup: no
# Preserve &amp;, that valid, but no default:
# http://api.html-tidy.org/tidy/quickref_next.html#preserve-entities
# https://github.com/htacg/tidy-html5/issues/732
preserve-entities: yes
# Disable information about HTML Tidy in console:
# http://api.html-tidy.org/tidy/quickref_next.html#quiet
quiet: yes
# Remove meta name="generator":
# http://api.html-tidy.org/tidy/quickref_next.html#tidy-mark
# Arguments:
# https://github.com/htacg/tidy-html5/issues/558#issuecomment-388899700
tidy-mark: no
# Disable warnings, if proprietary attributes:
# http://api.html-tidy.org/tidy/quickref_next.html#warn-proprietary-attributes
# I need delete this option in 5.8.0 HTML Tidy version:
# https://github.com/htacg/tidy-html5/issues/686
warn-proprietary-attributes: no
# Disable line breaks:
# http://api.html-tidy.org/tidy/quickref_next.html#wrap
# https://github.com/gavinballard/grunt-htmltidy/issues/6
wrap: 0

4. Steps to reproduce

tidy -config tidy.conf Sasha__Tidy--NonASCIIInConfiguration.html

5. Expected behavior

If first line (# “”) in tidy.conf no exists:

$ tidy -config tidy.conf Sasha__Tidy--NonASCIIInConfiguration.html
line 8 column 9 - Warning: trimming empty <span>

6. Actual behavior

Else first line (# “”) exists:

$ tidy -config tidy.conf Sasha__Tidy--NonASCIIInConfiguration.html
Warning: replacing invalid character code 128
Warning: replacing invalid character code 156
Warning: replacing invalid character code 128
Warning: discarding invalid character code 157
line 8 column 9 - Warning: trimming empty <span>

Thanks.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions