Giter VIP home page Giter VIP logo

Comments (14)

pmeems avatar pmeems commented on August 26, 2024

Do you have a sample data set so I can test?

from mapwingis.

ultraTCS avatar ultraTCS commented on August 26, 2024

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.

map_window_waterways_shp

waterways_shp

waterways.shp.docx

from mapwingis.

sleschinski avatar sleschinski commented on August 26, 2024

from mapwingis.

ultraTCS avatar ultraTCS commented on August 26, 2024

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.

pmeems avatar pmeems commented on August 26, 2024

You need to zip your .shp, .shx and .dbf file and attach it.
I can't use just the .shp file.

from mapwingis.

ultraTCS avatar ultraTCS commented on August 26, 2024

@pmeems sorry about that
waterways.zip

from mapwingis.

pmeems avatar pmeems commented on August 26, 2024

I've just opened the shapefile in MW5 and I can't display the proper labels either:
image
But when I open the .dbf-file in OpenOffice Calc it can't show the text correctly as well:
image
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.

ultraTCS avatar ultraTCS commented on August 26, 2024

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.

pmeems avatar pmeems commented on August 26, 2024

What is the exact change you made?
I replaced
_label->text = OLE2CA(newVal);
with
_label->text = newVal;

But I still have these labels:
image

from mapwingis.

ultraTCS avatar ultraTCS commented on August 26, 2024

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.

capture

from mapwingis.

pmeems avatar pmeems commented on August 26, 2024

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.

ultraTCS avatar ultraTCS commented on August 26, 2024

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.

pmeems avatar pmeems commented on August 26, 2024

I've just committed this change since I didn't found any errors.
I'm closing this issue.

from mapwingis.

pmeems avatar pmeems commented on August 26, 2024

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:
image

from mapwingis.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.