Comments (14)
Do you have a sample data set so I can test?
from mapwingis.
Hello Paul,
Thanks for your quick response.
I’ve attached the shape file waterways.shp (had to append .docx extension to attach). The .png file is what it looks like when we load the shape file into our application.
The following code is to UTF-8 encode the cell values from the table of the shape file. After second MultiByteToWideChar call, the Korean characters are correctly seen when debugging. Passing the encoded text to MapWinGIS::Label PutText(…) doesn’t seem to render properly. We’ve tested MapWindow5 application with same shape file and the MapWindow5 application doesn’t recognize Korean characters either (see second .png attached).
_variant_t cellVal = shapeFile->GetCellValue(realFieldIndex, i);
_bstr_t bstr = _bstr_t(cellVal);
int length = MultiByteToWideChar(CP_UTF8, 0, bstr, bstr.length(), NULL, 0);
std::wstring wstr;
wstr.resize(length);
MultiByteToWideChar(CP_UTF8, 0, bstr, bstr.length(), &wstr[0], length);
if (numLabels >= numShapes && i < numLabels)
{
shapeFile->GetLabels()->GetLabel(i, 0)->PutText(wstr.c_str());
…
}
Thanks again.
from mapwingis.
from mapwingis.
Hi Sergey, thanks for your input.
Code Pages are not a viable option at this time. Are you suggesting that the Labels.put_Text API is such that Unicode is not currently supported?
@pmeems Can you confirm this is the case? Are there alternative options to display the text?
Thanks.
from mapwingis.
You need to zip your .shp, .shx and .dbf file and attach it.
I can't use just the .shp file.
from mapwingis.
@pmeems sorry about that
waterways.zip
from mapwingis.
I've just opened the shapefile in MW5 and I can't display the proper labels either:
But when I open the .dbf-file in OpenOffice Calc it can't show the text correctly as well:
So it really seems a machine issue, making it very hard to debug and fix.
As Sergey mentioned, in the code Unicode is converted to ANSI which doesn't help either.
At this moment we're short on C++ knowledge in this project.
Please let me know if you do know how to solve this.
from mapwingis.
Well we are building the ocx from source so I removed the conversion in the put_Text API and it displays the labels with the encoding.
from mapwingis.
What is the exact change you made?
I replaced
_label->text = OLE2CA(newVal);
with
_label->text = newVal;
But I still have these labels:
from mapwingis.
Well that is odd Paul, as that is the exact change made to the interface. See my results below.
I will follow up if we see any issues once the update is committed to the team here, as it is only in my development configuration at this time.
from mapwingis.
I have no C++ knowledge at all, but it looks like it has to do something with the Windows Code Pages like Sergey suggested.
I'll keep the change for a while and if I don't find other problems I'll keep the change since it looks like to solve part of the problem.
from mapwingis.
Agreed, I don't think this is a long-term solution or even a full solution. Bottom line is it works for us for the moment.
The OLE2CA macro Sergey referenced is used quite frequently in the source; so that is also something to consider.
from mapwingis.
I've just committed this change since I didn't found any errors.
I'm closing this issue.
from mapwingis.
I'm working on https://mapwindow.atlassian.net/browse/CORE-199 which is about issues with Russian labels.
I've made some changes showing the labels in proper Russian and the changes also solved this issue with the Korean labels:
from mapwingis.
Related Issues (20)
- Opening ECW Files HOT 8
- Index out of range exception in ShapeFileDrawing.cp
- Linestyle ignored when drawing Polygon
- DrawPolygon Crash in MFC HOT 3
- Delphi: MapWinGIS_TLB.pas doesn't compile HOT 3
- can not run application with debug HOT 2
- Tiles display incorrect when the projection is not WGS84 HOT 1
- CShapefileDrawer sfDrawer in Map_Drawing.cpp missing a param [zoom]. HOT 3
- May invalid SpatialIndex file(.mwd\.mwx) cause shape file not display correctly. HOT 1
- Line patterns with markers do not work properly HOT 2
- Gdal 3.4.0 Load Geotiff Not Show HOT 29
- shift in vertex after mouseUp while using snap tool when vertex edit
- MapWinGis.ocx fail to registered in Visual studio 2022 HOT 1
- Transparent fill HOT 1
- Points layer display order may in correct.
- Shape.get_XY does not work because of wrong interface-description HOT 1
- Issue between MapWinGIS 5.3.0 and CrystalReports 13.0.31.4010
- i get this error, pls help me
- Error: Image.Save with creating world file HOT 2
- While I input an expression like “$perimeter 9”, then caused the crash.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mapwingis.