Saturday, September 3, 2011

Fix Chinese characters issue in Map for iPhone/iPad sold in China

As discussed in this post: chinese-iphone-4-serious-map-issues

  • Street names in the build-in Map app are in Chinese characters for all countries.
  • Changing the region/language in settings does not affect that.
The root cause is that the map data has been hardcoded to serve from ditu.google.cn instead of the general Google Map server at maps.google.com

The following is a fix from here, but that did NOT work for me and a few people I have seen in the aforementioned post.
Go to /System/Library/Caches/com.apple.dyld/ and copy dyld_shared_cache_armv7 to your pc
Use a hex editor (i use hex editor neo for windows) to make the following changes:
- search for ditu, and replace ditu with maps (only 1 reference)
- search for google.cn and replace cn with fr (only 1 reference)
Save file
Rename original file on iPhone_OLD
Copy over edited file to iPhone
Reboot
Voila - Maps in English
I ended up getting stuck at the white Apple logo during boot, and had to restore my iPad :(

After playing around that dyld_shared_cache_armv7 file, I found that the MD5 checksum was different when I did two copies via WinSCP. It is possibly the file is always changing, or it is just corrupted during the transfer, which causes the crash during boot. To overcome this, I decide to edit the file in place with the basic unix toolchain.

So here is my fix for the fix. (Tested with iPad + iOS 4.3.3 + Jailbreak by Jailbreak.me 3.0)

1. Install OpenSSH from Cydia
2. Create a file "patch.sh" with this content:
printf '\x6d\x61\x70\x73' | dd conv=notrunc of=/System/Library/Caches/com.apple.dyld/dyld_shared_cache_armv7 bs=1 seek=37841376 
printf '\x75\x73' | dd conv=notrunc of=/System/Library/Caches/com.apple.dyld/dyld_shared_cache_armv7 bs=1 seek=101924630
#The 1st line replaces "ditu" with "maps", while the 2nd line replaces "cn" with "us".
#37841376 and 101924630 are the corresponding HEX address in Decimal. You may want to verify them with a hex editor as in the original fix.
3. Copy over the file to iOS, e.g. /var/root
4. Run ./patch.sh
5. Reboot
6. No more Apple logo and Chinese in Map!


Update 1:
An anonymous commenter shared some more detailed steps that were not clear in my tutorial. I'll quote them here, but credit goes to him/her. Thank you!
Using Winscp, create a file >Files>new>file...
Name it patch.sh and paste the code 
printf '\x6d\x61\x70\x73' | dd conv=notrunc of=/System/Library/Caches/com.apple.dyld/dyld_shared_cache_armv7 bs=1 seek=XXXXXXXXX 
printf '\x75\x73' | dd conv=notrunc of=/System/Library/Caches/com.apple.dyld/dyld_shared_cache_armv7 bs=1 seek=XXXXXXXXX
Replace de XXXXXX after seek= with the number you get when using HxD hex editor, >search>find>search for - google.us select only the us and copy the number you see on the bottom left for me was offset:13654496 for ditu to maps and 66989846 for cn to us.
Then back to WinSCP right click on the dyld_shared_cache_armv7 and propieties, then change the octas to 0777, before running the command (right click on patch.sh, custom commands and execute) after you get an error change the Octas back from 0777 to 0644 default.

Update 2:
After installing the new iOS 5 GM, I found that this issue no longer existed. Maybe it will reappear in the final release. For those who don't need jailbreak/unlock, upgrading to iOS 5 might be a good option.

Update 3:
Some non-Chinese iPhone is having this problem after upgrading to iOS5. Now the map seems to be bound to SIM card, not where it is sold. Since I'm currently using an T-mobile SIM card, I have no such issue. I have jailbreak and a Chinese SIM card lying around, so I'll report back when I have more results.











21 comments:

  1. Should you copy the file patch.sh to the same folder? as the dyld_shared_cache_armv7

    Thanks

    ReplyDelete
  2. Thanks, my hex address dont seem to match i get an error when executing it... any ideas? thnaks

    ReplyDelete
  3. I had an error, something like /r error, when saving the file in Windows. You need to save it in Unix format. I can attach a file later if you have this sane error.

    If not, could you post the exact error message?

    ReplyDelete
  4. Sorry a bit of a noob here, how do you run it? what program are u using? Winscp? thx

    +1 on the file download

    ReplyDelete
  5. Ok this really works, this is waht i did hope this helps all the noobs out there that got trouble like me.

    Using Winscp, create a file >Files>new>file...

    Name it patch.sh and paste the code

    printf '\x6d\x61\x70\x73' | dd conv=notrunc of=/System/Library/Caches/com.apple.dyld/dyld_shared_cache_armv7 bs=1 seek=XXXXXXXXX
    printf '\x75\x73' | dd conv=notrunc of=/System/Library/Caches/com.apple.dyld/dyld_shared_cache_armv7 bs=1 seek=XXXXXXXXX

    Replace de XXXXXX after seek= with the number you get when using HxD hex editor, >search>find>search for - google.us select only the us and copy the number you see on the bottom left for me was offset:13654496 for ditu to maps and 66989846 for cn to us.

    Then back to WinSCP right click on the dyld_shared_cache_armv7 and propieties, then change the octas to 0777, before running the command (right click on patch.sh, custom commands and execute) after you get an error change the Octas back from 0777 to 0644 default.

    and voila!! hope this helps! thanks for finding this fix!

    ReplyDelete
  6. Onto the patch file solution, and I'm getting an error message when I run it: "-sh: line 6: ./patch.sh: Permission denied". I have changed Octas, as instructed, but the underlying dlyd file being edited direct on the phone isn't being changed when the patch file is run.

    Is there something I miss?

    ReplyDelete
  7. Did you change the octas of patch.sh or dlyd file?

    ReplyDelete
  8. Yep, I changed it, no more error but file still didn't change. I shall change both octas files?

    If editing the files with Hex Editor, even if file size is exactly the same, I still get stuck with apple logo after rebooting.

    I'm using an Ipod Touch 3 on firware 4.33

    ReplyDelete
  9. Only patch.sh needs to be set to 0777. You should not touch/edit dlyd file, otherwise you would stuck at apple logo.

    Are you sure you have the correct offset(seek = XXXXXX) for both string?

    ReplyDelete
  10. This issue comes in my iPad 2 after I just upgraded to iOS 5. My iPad 2 is from the US and I am currently in Beijing. Could you suggest an alternative approach since iOS in iPad 2 is not jailbreakable at this moment? Thanks.

    ReplyDelete
  11. thanks for this, but is there anyway to do this on a mac and not jailbreak??

    ReplyDelete
  12. If your iPad2 is from US, then you won't need this issue. Only iPad/iPhone that are sold in Chinese Apple Store has this problem.

    ReplyDelete
  13. You can do it on a Mac with any Hex editor and a SCP client. For example, you can use Hex Fiend and Cyberduck. There are free alternatives.

    However jailbreak is required, because Apple's file integrity check has to be turned off before applying the patch.

    ReplyDelete
  14. Hi overmindxp,
    my iPad 2 is indeed bought from the US. But after I just upgraded to iOS 5, the map app indeed changed to the chinese map thing. Please note that when I upgrade it to iOS 5, I am currently residing in Beijing, China. And using a chinese network--is this a problem? I used VPN network tethering but seems no good. My apple ID is also US.

    Could you suggest a method to fix it? Thanks a lot!

    "This issue comes in my iPad 2 after I just upgraded to iOS 5. My iPad 2 is from the US and I am currently in Beijing. Could you suggest an alternative approach since iOS in iPad 2 is not jailbreakable at this moment? Thanks."

    ReplyDelete
  15. Some more updates on this: I just upgraded my Non-China iPhone 4 to iOS 5. The phone gives me also the chinese map... This is so weird.. Please share your thoughts, thanks.

    ReplyDelete
  16. @Alan, Does your iPad/iPhone have Chinese characters on the back, next to the place where it usually says "Designed by Apple in California"? If not, my fix doesn't really apply to you.

    Here are some things you can check:
    1. Do you see Chinese in US map or just China map?
    2. Try open up maps.google.com in your PC/Mac. Do you see Chinese in US map?
    3. Did you set your iOS region/language to Chinese?

    ReplyDelete
  17. http://forums.macrumors.com/showthread.php?t=1249350 it happens to no Chinese Iphone after ios 5.0 too

    ReplyDelete
  18. @overmindxp my iPad/iPhone do not have any chinese characters on the back.
    Here's my response to the check you mentioned:
    Here are some things you can check:
    1. Do you see Chinese in US map or just China map?
    I see Chinese in US map.
    2. Try open up maps.google.com in your PC/Mac. Do you see Chinese in US map?
    I see English only map on my Mac, without any VPN connection.
    3. Did you set your iOS region/language to Chinese?
    No. Everything is in US/English.

    I tried to use VPN while closing the location service, I still got the chinese character map on my iPhone...

    ReplyDelete
  19. @Alan, it looks like many non-Chinese iPhone are having this issue after upgrading to iOS5. I suspect it's bound to SIM card, because I'm using an T-mobile SIM card. I'll look into that in a few days, and report back. In the mean time, if you have an US SIM card, you can try that as well.

    ReplyDelete
  20. hi @overmindxp, i think your method could not explain that I pulled out my iPad 2's SIM card during the update but iPad 2's google map is chinese...

    ReplyDelete