[PATCH] DLD upload

Miika Turkia miika.turkia at gmail.com
Fri Mar 15 11:02:41 PDT 2013


On Fri, Mar 15, 2013 at 7:47 PM, Dirk Hohndel <dirk at hohndel.org> wrote:
> Miika Turkia <miika.turkia at gmail.com> writes:
>> I have attached my version of the patch (that is effectively exactly
>> same what Sergey sent, but that is what I already had in my xslt file
>> at the time).But as said I am not sure if this is the right way to go.
>> At least I would like to get input from Rainer first to hear his
>> opinion about the kind of double-encoding issue.
>
> So here's an XML (4.xml) that came from the DLD export of the current
> subsurfacetest dive log:
>
> <?xml version="1.0" encoding="iso-8859-1"?>
> <DIVELOGSDATA>
>   <DIVELOGSDIVENUMBER>4</DIVELOGSDIVENUMBER>
>   <DIVELOGSID>607980</DIVELOGSID>
>   <DATE>03.03.2013</DATE>
>   <TIME>10:30:00</TIME>
>   <DIVETIMESEC>2700</DIVETIMESEC>
>   <SURFACETIME>0</SURFACETIME>
>   <MAXDEPTH>30.5</MAXDEPTH>
>   <MEANDEPTH>24.4</MEANDEPTH>
>   <LOCATION><![CDATA[красивый остров]]></LOCATION>
>   <SITE><![CDATA[Некотор&]]></SITE>
>   <WEATHER><![CDATA[от&#1083]]></WEATHER>
>   <WATERVIZIBILITY><![CDATA[отли&#]]></WATERVIZIBILITY>
>   <AIRTEMP>31.1</AIRTEMP>
>   <WATERTEMPMAXDEPTH>29.4</WATERTEMPMAXDEPTH>
>   <WATERTEMPATEND>30.6</WATERTEMPATEND>
>   <PARTNER><![CDATA[Дмитрий]]></PARTNER>
>   <BOATNAME><![CDATA[открыти&]]></BOATNAME>
>   <CYLINDERDESCRIPTION><![CDATA[алюми&#108]]></CYLINDERDESCRIPTION>
>   <DBLTANK>0</DBLTANK>
>   <CYLINDERSIZE>10.96</CYLINDERSIZE>
>   <CYLINDERSTARTPRESSURE>206.70</CYLINDERSTARTPRESSURE>
>   <CYLINDERENDPRESSURE>68.90</CYLINDERENDPRESSURE>
>   <WORKINGPRESSURE>206.70</WORKINGPRESSURE>
>   <WEIGHT>4.54</WEIGHT>
>   <O2PCT>36.0</O2PCT>
>   <LOGNOTES><![CDATA[Это тест погружения, который пытается использовать символы кириллицы в стольких местах, как это возможно.]]></LOGNOTES>
>   <LAT>-3.878241</LAT>
>   <LNG>-32.456017</LNG>
>   <GOOGLEMAPSZOOMLEVEL>14</GOOGLEMAPSZOOMLEVEL>
>   <SAMPLEINTERVAL></SAMPLEINTERVAL>
> </DIVELOGSDATA>
>
> if I run
>    xsltproc -o 4a.xml xslt/divelogs.xslt 4.xml
> I get
>
> <?xml version="1.0"?>
> <divelog program="subsurface-import" version="2">
>   <dives>
>     <dive number="4" date="03.03.2013" time="10:30:00" duration="45:00 min">
>       <depth max="30.5 m" mean="24.4 m"/>
>       <location>красивый остров / Некотор&</location>
>       <gps>-3.878241 -32.456017</gps>
>       <temperature air="31.1" water="29.4"/>
>       <buddy>Дмитрий</buddy>
>       <cylinder o2="36.0" start="206.70" end="68.90" size="10.96" workpressure="206.70" description="&#1072;&#1083;&#1102;&#1084;&#1080;&#108"/>
>       <weightsystem description="unknown" weight="4.54 kg"/>
>       <notes>Это тест погружения, который пытается использовать символы кириллицы в стольких местах, как это возможно.</notes>
>     </dive>
>   </dives>
> </divelog>
>
> which looks really sane (well, it looks like it parses correctly).
>
> But if I do
>     ./subsurface 4.xml
> and then save to 4b.xml this is what I get:
>
> <divelog program='subsurface' version='2'>
> <settings>
> </settings>
> <dives>
> <dive number='4' date='2013-03-03' time='10:30:00' duration='45:00 min'>
>   <location gps='-3.878241 -32.456017'/>
>   <cylinder size='10.96 l' workpressure='206.7 bar' description='&#1072;&#1083;&#1102;&#1084;&#1080;&#108' o2='36.0%' start='206.7 bar' end='68.9 bar' />
>   <weightsystem weight='4.54 kg' description='unknown' />
>   <divecomputer>
>   <depth max='30.5 m' mean='24.4 m' />
>   <temperature air='31.1 C' water='29.4 C' />
>   </divecomputer>
> </dive>
> </dives>
> </divelog>
>
> Which is clearly bogus. I tried to check if the correct xslt stylesheet
> was used and yes, that's confirmed.
>
> This is missing location name, buddy name, etc... and then escapes the
> '&' (I haven't done that part of the code, yet - first trying to track
> down why this doesn't work right to begin with)

I am wondering the same thing myself.

I have also been playing with the attached patch. The debug print
seems to indicate that the buffer is formatted properly, but then it
just does not work. I wonder if this is related to the above oddity.

miika
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Testing-of-decoding-char-references.patch
Type: application/octet-stream
Size: 1308 bytes
Desc: not available
URL: <http://lists.hohndel.org/pipermail/subsurface/attachments/20130315/24dc28cc/attachment-0001.obj>


More information about the subsurface mailing list