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
{{ message }}
Repository navigation
fragment.render encodes norwegian(possibley others as well) characters #38
Dim fragment = CsQuery.CQ.Create(value)
Dim res As String = fragment.Render(CsQuery.DomRenderingOptions.QuoteAllAttributes Or CsQuery.DomRenderingOptions.RemoveComments)
The Norwegian charcters æøå gets HTMLEncoded to &# xxx; format
Maybe add an option to CsQuery.DomRenderingOptions to keep such characters
Yes, I agree this should be an option. The target for the Render method has always been for a web browser, where it doesn't make a difference since the browser stores internally as unicode whichever way the source comes. But if you were going to extract text from the output of Render, this could be a problem. Should not be hard to add.
I added two new DomRenderingOptions to either stop encoding altogether HtmlEncodingNone --which may not produce valid HTML -- or only encode carets and ampersands HtmlEncodingMinimum -- which should still produce valid HTML but won't encode any unicode or other characers.
Not 100% thrilled about adding non-boolean value to DomRenderingOptions. That is, this should be an option, not two flags that overlap. So this API may change before the next release - I might make the config into an object with properties beyond just the flags.
Yes, I agree this should be an option. The target for the Render method has always been for a web browser, where it doesn't make a difference since the browser stores internally as unicode whichever way the source comes. But if you were going to extract text from the output of Render, this could be a problem. Should not be hard to add.
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/38#issuecomment-8302292.
Made significant changes to the model for rendering, the code is in the current push. This is going to break anything you may have coded against DomRenderingOptions.HtmlEncodingxxx. The new model uses an interface to describe an output formatter, of which there are a lot of defaults, or you can compose one from a combination of DomRenderingOptions flags and an HTML encoder defined using the IHtmlEncoder interface.
It's a bit more complicated but provides unlimited flexibility, and there are built-in objects for all common cases that are accesible from a simple factory. Docs here.
All you should have to do to update is (for example) if you were using
var html = dom.Render(DomRenderingOptions.HtmlEncodingMinimum);
would be to change to:
var html = dom.Render(OutputFormatters.HtmlEncodingMinimum);
There are a lot more possibilities now though, see the docs for more details. I'm happy with this model and this will likely be in the final release of 1.3 (hopefully very soon!).
Activity
jamietre commentedon Sep 5, 2012
Yes, I agree this should be an option. The target for the
Rendermethod has always been for a web browser, where it doesn't make a difference since the browser stores internally as unicode whichever way the source comes. But if you were going to extract text from the output of Render, this could be a problem. Should not be hard to add.jamietre commentedon Sep 5, 2012
Addressed in last commit: 508ef41
I added two new
DomRenderingOptionsto either stop encoding altogetherHtmlEncodingNone--which may not produce valid HTML -- or only encode carets and ampersandsHtmlEncodingMinimum-- which should still produce valid HTML but won't encode any unicode or other characers.Not 100% thrilled about adding non-boolean value to
DomRenderingOptions. That is, this should be an option, not two flags that overlap. So this API may change before the next release - I might make the config into an object with properties beyond just the flags.petterek commentedon Sep 5, 2012
Superb working..
Sendt fra en Samsung Mobil
James Treworgy notifications@github.com skrev:
Yes, I agree this should be an option. The target for the Render method has always been for a web browser, where it doesn't make a difference since the browser stores internally as unicode whichever way the source comes. But if you were going to extract text from the output of Render, this could be a problem. Should not be hard to add.
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/38#issuecomment-8302292.
jamietre commentedon Oct 9, 2012
Made significant changes to the model for rendering, the code is in the current push. This is going to break anything you may have coded against
DomRenderingOptions.HtmlEncodingxxx. The new model uses an interface to describe an output formatter, of which there are a lot of defaults, or you can compose one from a combination ofDomRenderingOptionsflags and an HTML encoder defined using theIHtmlEncoderinterface.It's a bit more complicated but provides unlimited flexibility, and there are built-in objects for all common cases that are accesible from a simple factory. Docs here.
https://github.com/jamietre/CsQuery/blob/master/documentation/output.md
All you should have to do to update is (for example) if you were using
would be to change to:
There are a lot more possibilities now though, see the docs for more details. I'm happy with this model and this will likely be in the final release of 1.3 (hopefully very soon!).
petterek commentedon Oct 10, 2012
Worked very well.
All my testes passed.