All : modify macro FROM_UTF8, to ensure compatibility with files using a non utf8 encoding (old files created under Window, having some non ASCII characters).
This commit is contained in:
parent
60ff82bf44
commit
85b8fc66ee
|
@ -0,0 +1,39 @@
|
||||||
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||||
|
|
||||||
|
<!--XSL style sheet that takes EESCHEMA's Generic Netlist Format as input and
|
||||||
|
outputs a simple BOM in CSV format. Feel free to enhance this and submit
|
||||||
|
patches.
|
||||||
|
|
||||||
|
How to use:
|
||||||
|
Eeschema.pdf: chapter 14
|
||||||
|
-->
|
||||||
|
|
||||||
|
<!DOCTYPE xsl:stylesheet [
|
||||||
|
<!ENTITY nl "
"> <!--new line CR, LF -->
|
||||||
|
]>
|
||||||
|
|
||||||
|
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||||
|
<xsl:output method="text" omit-xml-declaration="yes" indent="no"/>
|
||||||
|
|
||||||
|
<!-- for each component -->
|
||||||
|
<xsl:template match="libpart">
|
||||||
|
|
||||||
|
<!--
|
||||||
|
<xsl:value-of select="count(//comp/libsource/@part[@part])"/><xsl:text>,</xsl:text>
|
||||||
|
-->
|
||||||
|
|
||||||
|
<xsl:value-of select="@part"/><xsl:text>,</xsl:text>
|
||||||
|
<xsl:value-of select="description"/><xsl:text>,</xsl:text>
|
||||||
|
<xsl:value-of select="@lib"/>
|
||||||
|
|
||||||
|
<xsl:text>&nl;</xsl:text>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
|
||||||
|
<xsl:template match="/export">
|
||||||
|
<xsl:text>qty,partname,description,lib&nl;</xsl:text>
|
||||||
|
<xsl:apply-templates select="libparts/libpart"/>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
|
||||||
|
</xsl:stylesheet>
|
|
@ -4,7 +4,7 @@
|
||||||
GPL v2.
|
GPL v2.
|
||||||
|
|
||||||
How to use:
|
How to use:
|
||||||
https://lists.launchpad.net/kicad-developers/msg05157.html
|
see eeschema.pdf, chapter 14
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<!DOCTYPE xsl:stylesheet [
|
<!DOCTYPE xsl:stylesheet [
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
GPL v2.
|
GPL v2.
|
||||||
|
|
||||||
How to use:
|
How to use:
|
||||||
https://lists.launchpad.net/kicad-developers/msg05157.html
|
see eeschema.pdf, chapter 14
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<!DOCTYPE xsl:stylesheet [
|
<!DOCTYPE xsl:stylesheet [
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
GPL v2.
|
GPL v2.
|
||||||
|
|
||||||
How to use:
|
How to use:
|
||||||
https://lists.launchpad.net/kicad-developers/msg05157.html
|
see eeschema.pdf, chapter 14
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<!DOCTYPE xsl:stylesheet [
|
<!DOCTYPE xsl:stylesheet [
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
GPL v2.
|
GPL v2.
|
||||||
|
|
||||||
How to use:
|
How to use:
|
||||||
https://lists.launchpad.net/kicad-developers/msg05157.html
|
see eeschema.pdf, chapter 14
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<!DOCTYPE xsl:stylesheet [
|
<!DOCTYPE xsl:stylesheet [
|
||||||
|
|
|
@ -19,8 +19,14 @@
|
||||||
* Macro FROM_UTF8
|
* Macro FROM_UTF8
|
||||||
* converts a UTF8 encoded C string to a wxString for all wxWidgets build modes.
|
* converts a UTF8 encoded C string to a wxString for all wxWidgets build modes.
|
||||||
*/
|
*/
|
||||||
#define FROM_UTF8( cstring ) wxString::FromUTF8( cstring )
|
//#define FROM_UTF8( cstring ) wxString::FromUTF8( cstring )
|
||||||
|
inline wxString FROM_UTF8( const char* cstring )
|
||||||
|
{
|
||||||
|
wxString line = wxString::FromUTF8( cstring );
|
||||||
|
if( line.IsEmpty() ) // happens when cstring is not a valid UTF8 sequence
|
||||||
|
line = wxConvCurrent->cMB2WC( cstring ); // try to use locale conversion
|
||||||
|
return line;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Function GetChars
|
* Function GetChars
|
||||||
* returns a wxChar* to the actual character data within a wxString, and is
|
* returns a wxChar* to the actual character data within a wxString, and is
|
||||||
|
|
Loading…
Reference in New Issue