Beee4life / acf-city-selector

An ACF extension to create a new field type, where you can select a city based on country and provence/state.
38 stars 15 forks source link

Failure in importing Chinese city names:upload was successful, but filed form showed nothing and preview was blank #119

Closed arthurcrh closed 7 months ago

arthurcrh commented 1 year ago

china.csv 微信截图_20221123051948

I was uploading cities with chinese names. The verification was successful, but nothing came out: "city name" "state name" "country name" in preview was blank , and the actual field form showed nothing "no country". I assume that something went wrong in the importing function ,using '' instead of "" , resulting in chinese words not loaded.

Beee4life commented 1 year ago

I opened the attached file in a plain text editor and this showed

Screenshot 2022-11-23 at 22 09 23

so not really a surprise.

arthurcrh commented 1 year ago

I said ,it was written in CHINESE. Nothing surprise to me either. It looks totally normal on my computer. 微信截图_20221124082806 I wonder if there is a way to transcode?

Beee4life commented 1 year ago

I'm not sure what the solution is, if there is one... never used non-roman characters.

arthurcrh commented 1 year ago

It seems that I found a possible solution: make a UTF-8 format .csv file change into bgk format, which supports chinese contents.

I`m going to test it on my website later. If it work, I will mark this issue solved then.

arthurcrh commented 1 year ago

Nope. Using bgk is a closer approach, but it did not do as expected. Can you tell me where to find the source code relating to importing csv files into plugin data? I think I can find the clue there once the importing procedure is exposed. Thanks!

arthurcrh commented 1 year ago

Update : Using notepad, I changed the csv into utf-8 format and saved,uploaded. Now the preview version looks fine. china_1.csv 微信截图_20221125123957 But another problem came out. Although I imported 30+"countries" , and numerous "state/province" (specified by column name), only one item showed up in "country" and "state/province drop down". And the only showed up item in "country" is no even the first input from my file.see it below.

image The dropdown gave me 1 item to select from in "country", 1 item to select from in "state/province" , and "city" work seems to be normal .I was checking other issues posted by users here, and found some similar problem like :https://github.com/Beee4life/acf-city-selector/issues/111

What could lead to such porblem? Limited usage of page resources of some kind?

arthurcrh commented 1 year ago

Alright. I just assigned some different values to country code and state code, suddenly some country and state showed up accordingly. It seems that same code somehow jammed the plugins inner logic. The thing is, country and state code is really useless for me (and for a whole lot of people, of which I am certain). Where should I look into and modify some codes so that those two rows are not read by the plugin anymore, not interfering with the end result of dropdown?

Beee4life commented 1 year ago

Using notepad, I changed the csv into utf-8 format and saved,uploaded. Now the preview version looks fine.

Good to hear...

The dropdown gave me 1 item to select from in "country", 1 item to select from in "state/province" , and "city" work seems to be normal.

I'm not sure if I understand. I downloaded your UTF-8 formatted csv and will have to import locally to see what happens.

arthurcrh commented 1 year ago

Using notepad, I changed the csv into utf-8 format and saved,uploaded. Now the preview version looks fine.

Good to hear...

The dropdown gave me 1 item to select from in "country", 1 item to select from in "state/province" , and "city" work seems to be normal.

I'm not sure if I understand. I downloaded your UTF-8 formatted csv and will have to import locally to see what happens.

Thank you. As I wrote in previous two replies, I was assuming that this problem is because of me issuing "AA" for every country code and state code. But after a short test of me issuing different codes to them, more options were displayed in the dropdown, but a lot of selections were still missing.

Beee4life commented 1 year ago

I just imported your csv file successfully but I can't replicate your issue (yet).

I can see multiple countries as you can see.

Screenshot 2022-12-11 at 19 06 07

Beee4life commented 1 year ago

The dropdown gave me 1 item to select from in "country", 1 item to select from in "state/province" , and "city" work seems to be normal.

Your csv contains 1 country and 1 state, so that is correct.

As you can see I can see various cities.

Screenshot 2022-12-11 at 19 08 50

doocii commented 1 year ago

建议还是购买他的插件扩展包,修改城市代码这样的工作方式对于我有些愚蠢。不过是成功了 微信截图_20221228110345 微信截图_20221228110852

Beee4life commented 1 year ago

I don't speak chinese, sorry

Beee4life commented 1 year ago

@arthurcrh I updated the plugin, which also includes a for ordering in states. I hope this will also fix your issue (although not sure).

Beee4life commented 7 months ago

Closing due to inactivity.