@scfreak,
I just localized my latest app for China and had the same problem. I could display text from a table located within my modules, but I couldn’t enter and save anything to json from a textbox keyboard entry, I have a lot of user defined labels for buttons in the app.
After a couple of unsuccessful attempts to save Chinese text into json, I even tried changing my keyboard to Chinese, I took a look at the json file I was producing and instantly saw what I was saving wasn’t Chinese text.
Sound familiar?
When I first started learning to program 2 years ago, I literally spent weeks, I had NO idea what I was doing or how to debug, trying to figure out why my simple code wasn’t saving to json, this wasn’t involving special characters either.
Well it turned out the copy of json that was contained in the Corona library was out of date. I forget how I actually stumbled upon the fact, I think it came from researching json.
Anyways, when I saw the Chinese characters weren’t saving properly, at all actually, a google search turned up the “save as UTF8 BOM” solution. As you know, it didn’t work.
I’m sure by now you are saying to yourself, GET TO THE POINT ALREADY!
Well, I thought to myself, I’ve seen something like this before. Maybe a newer version of json will escape the special characters.
I’m not sure this solution will work for you, but it was like “magic” for me. Instead of taking WEEKS to solve, this show stopping fix took maybe 10 minutes.
Tony said it best in “Gold Rush”; Lessons cost $ and in the Yukon, GOOD lessons cost LOT$!
This is from my school of hard knocks.
His name is
David Heiko Kolf
I’m not sure, but I think this is the guy who coded json for lua. A piece of magical code that most, including me, take for granted daily.
So here’s what ya do.
Google dkjson.
Download the latest version, 2.4
Add it to your apps root folder.
Thinking about it, maybe Corona should do this too…
Now, whenever you "require(“json”) do this…
json = require(“dkjson”)
Declaring it this way will insure you get “dkjson” and not Corona’s.
Any of your other modules that use json should probably also require dkjson.
My Chinese characters all save properly in the simulator and on device. My app was just approved today by Apple and will be available in Chinese Simp and Chinese Trad.
Thank you David Kolf and thank you Rayond Cheng for helping me with my translation!
Hope this helps,
Nail