Code block and non-ascii

Topics: User Forum
Oct 19, 2007 at 7:51 AM
I have some code where the comments include non-ascii characters.

These characters disappear in the code block transformation. They work fine in all other parts of the helpfile.

A comment like
// aaaÖÖbbb

becomes
<span class="highlight-comment">// aaabbb</span>

Tried to html-encode the characters in the code but "& O u m l ;" becomes "& a m p ; O u m l ;"
Coordinator
Oct 20, 2007 at 2:41 AM
In an XML comments <code> tag or in an additional content HTML file? Either way, as long as the file is saved with UTF-8 encoding and includes the byte order marks at the start of the file, all should be well.

Eric
Oct 20, 2007 at 12:48 PM
Thank you for the reply. In this case it is code in a file included with source/region. Maybe that file for some reason isn't in utf-8. I'll check.

A couple of other comments regarding the code block component.
- Is it possible to make the source file not found error non-fatal? Loading the file comes late in a long build process so it annoying to have to restart just because of a typing error. It also makes it possible to add the code tags first and add the content later.

- Why can't I use the source/region attributes in additional content? It would be nice if I could ensure that code in the additional content is compilable.

I have a workaround today where I create a special "Examples" namespace and use the normal documentation functions with a static class for each example. The example then get the same layout as all other content and only drawback is the wording like "Examples namespace", "FirstExample class" and a "Syntax" block before the example code.

namespace Examples {
/// <summary> ... </summary>
/// ...
/// <example><code source="thisfile.cs" region="FirstExample"/></example>
public static class FirstExample {
/// <exclude/>
static FirstExample() {
#region FirstExample
// example code gors here
#endregion
}
}
Coordinator
Oct 20, 2007 at 9:06 PM
It would be possible to make the error non-fatal but I think it would be too easy to miss unless you go looking for it so I'll keep it the way it is. You can't use source and region on <pre> tags but you can use <code> tags with source and region attributes in additional content files. You can nest them within <pre> tags to merge snippets too. See the help file for details, specifically Importing and Colorizing Code from Source Files under The GUI Project Manager | Additional Content Properties section.

Eric