views:

395

answers:

2

Should I save imsmanifest.xml in UTF-8 or ANSI ?

ADL test suite 1.2 seem to fail with UTF8 header, but on otherhand some LMSes will fail if its not UTF8.

A: 

It's inconsistent. I think the best approach is to use UTF-8 and make sure it's explicitly declared in the xml header. If you look at the definition files http://www.scorm.com/scorm-explained/technical-scorm/content-packaging/xml-schema-definition-files/ some are UTF-8 and some don't descrive the encoding.

There doesn't seem to be a mention of the encoding in the guidelines either http://www.adlnet.gov/Technologies/scorm/SCORMSDocuments/SCORM%20Resources/ADLGuidelines_V1PublicComment.zip

I guess the issue is supposed to be handled at the layer below, ie with the xml parser. The only advice I can give is to add explicit encoding informatio to the xml header, and to ensure that they are consistent - open the file in a text editor and be sure it's UTF-8.

Edit: The header should be something like:

<?xml version="1.0" encoding="UTF-8"?>
UberAlex
what is correct header entry?
Tom
still gives error ERROR: The markup in the document preceding the root element must be well-formed. ERROR: The XML declaration may only appear at the very beginning of the document. ERROR: The manifest instance is NOT well-formed
Tom
That sounds like there is an error in your XML. Where are you adding the header, and is it exactly as above? What tool is giving the error?
UberAlex
+1  A: 

UberAlex is correct. SCORM leaves it up to the XML parser. SCORM merely says that it needs to be valid XML. If you are getting errors with XML parsers, make sure that the tool you are using to edit and save your manifest actually encodes the document using the same encoding that you specify. If you specify that the document is UTF-8, but the editor saves it as ASCII you can run into problems.

Also of note, in the run-time portion of SCORM, the characters are encoded as ISO 10646 (or, unicode. Since some data in the manifest can feed in to the run-time, ensure that your strings will be compatible with ISO 10646.

Also, make sure that any URLs, file paths and parameter strings are properly encoded for HTTP use.

Mike Rustici
Thanks, but I changed encoding like this, but test suite still says error The markup in the document preceding the root element must be well-formed.
Tom
Can you post your manifest somewhere? Are there perhaps XML comments before the XML header tag? Have you looked for hidden encoding characters as the start of the document?
Mike Rustici
This answer is broadly correct but contains some technical inaccuracies. If you declare an XML file as UTF-8 but save it as ASCII, then provided your file contains no non-ASCII characters, you cannot run into problems, since UTF-8 is a superset of ASCII. Other encoding mismatches will, however, cause problems.Your comment about ensuring that strings will be compatible with Unicode is misleading. By definition, a valid XML document contains only character data that can be represented in Unicode. This is true of all commonly used encodings.
Daniel Cassidy