Discussion:
[mapguide-users] WHat version of FDO is MapGuide 3.1.1 compiled against?
Hans Milling
2018-04-18 08:48:40 UTC
Permalink
Hi

I am trying to implement the fix for MapInfo TAB files that always uses
Windows 1252 and not UTF-8.
The OGR provider always assumes that files are UTF-8 and letters like é, æ
or ß turn out as chinese characters.
I have done this fixto MapGuide 2.2, 2.4, 2.6 and 3.1. This time for the
3.1.1 release the compiled DLL does not work. The OGRProvider.dll in the
MapGuide\Server\Fdo folder states version 4.1. But when I compile my own 4.1
OGRProvider.dll it cannot be loaded. The error is:
Unable to load the FDO Provider library '.\OGRProvider.dll': The specified
module could not be found. (Cause: , Root Cause: Unable to load the FDO
Provider library '.\OGRProvider.dll': The specified module could not be
found. )

Not many details there.
Is MapGuide 3.1.1 build against FDO trunk, or some other branch that is
still version 4.1?

This is the original post about the problem:
http://osgeo-org.1560.x6.nabble.com/FDO-OGR-3-6-3-7-and-UTF-8-problem-td3898674.html

This is my first follow up post:
http://osgeo-org.1560.x6.nabble.com/FDO-OGR-4-1-still-has-problems-with-Latin1-ISO-8859-1-when-using-MapInfo-TAB-td5289710.html#a5289983

Perhaps someone with the right build environment could compile the change
for me ;-)

in
Providers\OGR\Src\Provider\stdafx.h add this function:
static std::wstring A2W_SLOW_ASCII(const char* input)
{
int wlen = (int)strlen(input) + 1;
wchar_t* ws = (wchar_t*)alloca(sizeof(wchar_t)*wlen);
MultiByteToWideChar(CP_ACP, 0, input, -1, ws, wlen);
return std::wstring(ws);
}

in
Providers\OGR\Src\Provider\OgrProvider.cpp
change
m_sprops[(long)val] = A2W_SLOW(val);
to
m_sprops[(long)val] = A2W_SLOW_ASCII(val);

That is it. Only downside is that all files read by the OGR provider is
treated as ASCII/Windows 1252.

A perfect implementation would be something like
if (source_file_is_mapinfo_tab_or_mif)
m_sprops[(long)val] = A2W_SLOW(val);
else
m_sprops[(long)val] = A2W_SLOW_ASCII(val);

But I have no idea how to implement this.

Best Regards
Hans Milling



--
Sent from: http://osgeo-org.1560.x6.nabble.com/MapGuide-Users-f4182607.html
Jackie Ng
2018-04-18 10:34:33 UTC
Permalink
MGOS 3.1.1 was built against FDO 4.1 svn HEAD using the Microsoft Visual C++
2015 compiler.

On a related tangent: Would your code changes be general purpose enough to
roll into the OGR provider itself? We have a basic unit test suite for this
provider now. If you have an example TAB data file with such characters and
of clear documented and legal provenance (even better, is there an existing
TAB file from GDAL/OGR's test suite with similar characteristics that we can
reuse?) we should add test cases for this.

- Jackie



--
Sent from: http://osgeo-org.1560.x6.nabble.com/MapGuide-Users-f4182607.html
Hans Milling
2018-04-18 11:56:28 UTC
Permalink
All test data is in ASCII, and have no characters outsize the A-Z range.
I have created a very small test MapInfo TAB file:
https://www.geograf.com/filer/none_ascii.zip

The MapInfo table has two columns:
Stadt and Straße (city, street)
A sigle row with:
Güstrow, Neukruger Straße

The file is in WGS84 coordinate system, but this is not relevant for this
case.

This is how it looks in MapInfo:
<Loading Image...>

This is how it looks in QGIS (I believe they use OGR provider too, they
probably just handle it different than MapGuide after they receive the
data):
<Loading Image...>

Preview of feature source in MapGuide (Here it is clear that MapGuide cannot
handle none ascii characters from TAB files):
<Loading Image...>

Creating a layer works, but setting a filter is next to impossible:
<Loading Image...>

Best regards
Hans Milling...



--
Sent from: http://osgeo-org.1560.x6.nabble.com/MapGuide-Users-f4182607.html
Loading...