You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After I write chinese comments in CSS file which is encoded in utf-8, my program won't work.
It outputs:
I noticed that open(filename, "rt") in textual.css.stylesheet.Stylesheet.read without encoding, and it use cp936 as encoding by default.
So I write a patch in my program:
importosfromtextual.css.stylesheetimportStylesheet, CssSourcefrompathlibimportPurePathfromtextual.css.errorsimportStylesheetErrordefread(self, filename: str|PurePath) ->None:
"""Read Textual CSS file. Args: filename: Filename of CSS. Raises: StylesheetError: If the CSS could not be read. StylesheetParseError: If the CSS is invalid. """filename=os.path.expanduser(filename)
try:
withopen(filename, "rt", encoding="utf-8") ascss_file:
css=css_file.read()
path=os.path.abspath(filename)
exceptException:
raiseStylesheetError(f"unable to read CSS file {filename!r}") fromNoneself.source[(str(path), "")] =CssSource(css, False, 0)
self._require_parse=TrueStylesheet.read=read
Maybe maintainer can change it.
Is there any problem?
The text was updated successfully, but these errors were encountered:
After I write chinese comments in CSS file which is encoded in utf-8, my program won't work.
It outputs:
I noticed that
open(filename, "rt")
intextual.css.stylesheet.Stylesheet.read
without encoding, and it use cp936 as encoding by default.So I write a patch in my program:
Maybe maintainer can change it.
Is there any problem?
The text was updated successfully, but these errors were encountered: