Hi all,
I'm working on LPP-8045 right now, encoding support for external CSS
stylesheets.
http://jira.openlaszlo.org/jira/browse/LPP-8045
Here's what I want to do:
add an @encoding attribute to the stylesheet tag, found the classes
http://svn.openlaszlo.org/openlaszlo/trunk/WEB-INF/lps/lfc/services/LzStyleSheet.lzs
http://svn.openlaszlo.org/openlaszlo/trunk/WEB-INF/lps/lfc/services/LzCSSStyleSheet.lzs
The idea is to add an encoding attribute to LzStyleSheet. Based on
that the file loader in
org.openlaszlo.compiler.StyleSheetCompiler.java would take the
attribute value on pass it on to the CSSHandler:
// Actually parse and compile the stylesheet! W00t!
CSSHandler fileHandler =
CSSHandler.parse( resolvedFile, encoding);
In CSSHandler.parse() the encoding would be passed on to the
handler.getInputSource() method
public static CSSHandler parse(File file, String encoding)
throws CSSException {
try {
mLogger.info("creating CSSHandler");
....
parser.parseStyleSheet(handler.getInputSource(encoding));
And then modify getInputSource to:
/** @return InputSource object pointing to the CSS file. */
InputSource getInputSource(encoding) throws FileNotFoundException {
mLogger.info("Trying to open CSS file " + mFile + " with
encoding " + encoding);
InputSource is = null;
try {
is = new InputSource(new InputStreamReader(new
FileInputStream(mFile), encoding));
} catch (UnsupportedEncodingException e) {
mLogger.error("Unsupported encoding in file: " + mFile + ",
" + e.getMessage());
}
return is;
}
I need help!!!
I added a new attribute to LzStyleSheet.lzs, but it seems like the LZX
compiler doesn't complain if there are unkown attributes on a
stylesheet tag. Is that a bug? And how can I check if the attribute
value will be set inside the debugger? I can't access the stylesheet
object through an @id or @name in the debug console.
Thanks,
Raju