0

I try to follow the instruction at https://developer.mozilla.org/en/docs/Building_an_Extension to build a firefox add-on.

I changed install.rdf to

<?xml version="1.0"?>
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
     xmlns:em="http://www.mozilla.org/2004/em-rdf#">

  <Description about="urn:mozilla:install-manifest">

    <em:id>helloworld@mozilla.doslash.org</em:id>
    <em:name>Hello World extension for Firefox</em:name>
    <em:version>1.0</em:version>
    <em:description>Demo extension.</em:description>
    <em:creator>Nickolay Ponomarev</em:creator>
    <!-- optional items -->
    <em:contributor>A person who helped you</em:contributor>
    <em:contributor>Another one</em:contributor>
    <em:homepageURL>http://kb.mozillazine.org/Getting_started_with_extension_development</em:homepageURL>
    <!--em:optionsURL>chrome://sampleext/content/settings.xul</em:optionsURL>
    <em:aboutURL>chrome://sampleext/content/about.xul</em:aboutURL>
    <em:iconURL>chrome://sampleext/skin/mainicon.png</em:iconURL>


    <!-- Firefox -->
    <em:targetApplication>
      <Description>
        <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
        <em:minVersion>12.0</em:minVersion>
        <em:maxVersion>32.*</em:maxVersion>
      </Description>
    </em:targetApplication>

  </Description>

</RDF>

when install it reports

enter image description here

your comment welcome

arachide
  • 7,640
  • 17
  • 66
  • 128
  • An answer I provided for another question discusses some pitfalls which can lead to this exact error message: http://stackoverflow.com/questions/23690459/upgrading-firefox-extension/23690580#23690580 – nmaier May 18 '14 at 19:19

1 Answers1

0

The core files of an extension (install.rdf, chrome.manifest and bootstrap.js where applicable) must be saved with ANSI encoding. Check if your editor defaults to some unicode flavor.

paa
  • 4,958
  • 1
  • 15
  • 22
  • Actually, no. First of all [ANSI is not actually a single encoding](http://stackoverflow.com/questions/701882/what-is-ansi-format). And second of all XML/XBL/CSS/JS files should be UTF-8 without BOM (while theoretically other encoding are supported as well) while chrome.manifest should preferably be ASCII (which IIRC in theory it is UTF-8 without BOM, where ASCII is a subset of). – nmaier May 18 '14 at 19:17
  • PS: When it comes to RDF/XUL/XBL or XML in general, UTF-8 is implied by the underlying [XML standard](http://www.w3.org/TR/2008/REC-xml-20081126/#NT-EncodingDecl) if not specified otherwise in XML declaration. – nmaier May 18 '14 at 19:24
  • 1
    @nmaier I know one [nearly ubiquitous editor](http://en.wikipedia.org/wiki/Notepad_%28software%29) that saves utf-8 *only with BOM* and names ASCII as ANSI :-) Plus, I don't know if it has been fixed but utf-8 `bootstrap.js` (or any other js loaded with `loadSubScript` when the charset isn't explicitly set to utf-8) used to fail. – paa May 18 '14 at 20:16
  • Well, notepad `ANSI` is actually whatever code page is selected as the ANSI code page in Windows, or ["can be different on different computers"](http://msdn.microsoft.com/en-us/library/windows/desktop/dd317756%28v=vs.85%29.aspx). On most (western) systems ASCII is a subset of the ANSI code page, however... Or: Never use `notepad.exe`:p You have a good point about `loadSubScript`, although you can and probably should pass an explicit encoding (since Firefox 5). But that indeed causes `bootstrap.js` to be read as ASCII. I stand corrected on that point! – nmaier May 18 '14 at 20:34