<br><font size=2 face="sans-serif">Tom:</font>
<br>
<br><font size=2 face="sans-serif">As I recall, Pocket PC uses a unicode
charset. &nbsp;The chars managed in shpopen.c are 1 byte with char arrays
null-terminated. &nbsp;So, when you pass a string &quot;test.shp&quot;,
the unicode version ( 2-byte characters) of test.shp is t 0x00 e 0x00 s
0x00 t 0x00 . 0x00 s 0x00 h 0x00 p 0x00. &nbsp;The ascii version is test.shp
0x00. &nbsp;The c code sees t 0x00 and assumes it has reached the end of
the char array since there exists a null terminator (0x00). &nbsp;My guess
is you are going to need to manually switch back and forth between 1-byte
and 2-byte string chars during calls to the c dll and the PocketPC file
system to get this to work for you; i.e., fake out the system by packing
the non-null chars into a 2-byte unicode string &nbsp;and pass that pseudo-unicode
string to shpopen. &nbsp;Writing the file out to the PocketPC file system
is going to be a problem, though, because the filenames are going to be
gibberish. &nbsp;Somehow, you'll need to convert them back to unicode that
correctly represents the intended filenames.</font>
<br>
<br><font size=2 face="sans-serif">The alternative is to make some nontrivial
mods to the c source to make it unicode. &nbsp;If it were me, first I'd
play around with the (inelegant) workaround, above.</font>
<br>
<br><font size=2 face="sans-serif">Btw, I expect CharSet.Auto is equivalent
to CharSet.Unicode on PocketPC. &nbsp;It is not surprising that CharSet.Ascii
fails, since PocketPC is strictly unicode.</font>
<br>
<br><font size=2 face="sans-serif">Hope this helps. </font>
<br><font size=2 face="sans-serif"><br>
</font><font size=1 face="Verdana">David Gancarz, P.E.<br>
Systems Development Manager<br>
City of Orlando<br>
400 S Orange Ave<br>
Orlando, FL 32802<br>
(407) 246-3062<br>
</font>
<hr><font size=1 face="Verdana">Florida has a very broad public records
law. As a result, any written communication created or received by City
of Orlando officials and employees will be made available to the public
and media, upon request, unless otherwise exempt. Under Florida law, email
addresses are public records. If you do not want your email address released
in response to a public records request, do not send electronic mail to
this office. Instead, contact our office by phone or in writing.</font>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td width=40%><font size=1 face="sans-serif"><b>Tom Kazimiers &lt;2voodoo@gmx.de&gt;</b>
</font>
<br><font size=1 face="sans-serif">Sent by: shapelib-bounces@lists.maptools.org</font>
<p><font size=1 face="sans-serif">07/18/2007 07:04 AM</font>
<table border>
<tr valign=top>
<td bgcolor=white>
<div align=center><font size=1 face="sans-serif">Please respond to<br>
Shapelib Development &lt;shapelib@lists.maptools.org&gt;</font></div></table>
<br>
<td width=59%>
<table width=100%>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">To</font></div>
<td><font size=1 face="sans-serif">shapelib@lists.maptools.org</font>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">cc</font></div>
<td>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">Subject</font></div>
<td><font size=1 face="sans-serif">[Shapelib] SHPOpen (and SHPCreate) only
recognizes the first letter &nbsp; &nbsp; &nbsp; &nbsp;of filename</font></table>
<br>
<table>
<tr valign=top>
<td>
<td></table>
<br></table>
<br>
<br>
<br><font size=2><tt>Hi there,<br>
<br>
after struggleing some days around with getting Shapelib compiled for<br>
Pocket PC 2003 and Windows CE I finally succeeded with this and came up<br>
to the .Net wrapper I found on the net which is quite helpfull as I do<br>
not need to care about all the P/Invoke stuff out of C#.<br>
This worked after some work, too but for my last problem I did not find<br>
any solution.<br>
<br>
If I want to open or create a file with SHPOpen and SHPCreate only the<br>
first letter of the given filename is recognized. Furthermore if I have<br>
a filepair &quot;t.shx&quot; and &quot;t.shp&quot; and want to open &quot;test&quot;
- then t is opened.<br>
<br>
First of all I had to change something in the wrapper - namely the<br>
charset as Ascii (which was written there) was not found on my computer<br>
so I set it to auto:<br>
<br>
[DllImport(&quot;Shapelib.dll&quot;, CharSet = CharSet.Auto)]<br>
public static extern IntPtr SHPOpen(string szShapeFile, string szAccess);<br>
<br>
Could this already be a problem?<br>
<br>
Now I want to open a file:<br>
<br>
IntPtr hShp = ShapeLib.SHPOpen(&quot;test&quot;, &quot;rb&quot;);<br>
<br>
which succeeds if there is a file &quot;t.shx&quot; and &quot;t.shp&quot;,
but not if there<br>
are the files &quot;test.shx&quot; and &quot;test.shp&quot;.<br>
With the t-files I can read everything and work with them, but I want<br>
full filenames. The problem gets even worser if I want to use<br>
directories. (all the files mentioned above where saved in &quot;root&quot;)
as<br>
SHPOpen can't handle this. The same is true for creation of shapefile-pairs.<br>
<br>
I could image that there is a charset problem as I changed this in the<br>
MapTools.cs, but I don't know how to solve this.<br>
<br>
Do you have any ideas or hints?<br>
<br>
Thank you in advance.<br>
Tom<br>
<br>
<br>
_______________________________________________<br>
Shapelib mailing list<br>
Shapelib@lists.maptools.org<br>
http://lists.maptools.org/mailman/listinfo/shapelib<br>
</tt></font>
<br>