{"action":"created","issue":{"url":"https://api.github.com/repos/cocos2d/cocos2d-x/issues/10321","labels_url":"https://api.github.com/repos/cocos2d/cocos2d-x/issues/10321/labels{/name}","comments_url":"https://api.github.com/repos/cocos2d/cocos2d-x/issues/10321/comments","events_url":"https://api.github.com/repos/cocos2d/cocos2d-x/issues/10321/events","html_url":"https://github.com/cocos2d/cocos2d-x/issues/10321","id":56166530,"number":10321,"title":" Label::createWithBMFont and text with accents does not show","user":{"login":"KrissMu","id":9886322,"avatar_url":"https://avatars.githubusercontent.com/u/9886322?v=3","gravatar_id":"","url":"https://api.github.com/users/KrissMu","html_url":"https://github.com/KrissMu","followers_url":"https://api.github.com/users/KrissMu/followers","following_url":"https://api.github.com/users/KrissMu/following{/other_user}","gists_url":"https://api.github.com/users/KrissMu/gists{/gist_id}","starred_url":"https://api.github.com/users/KrissMu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KrissMu/subscriptions","organizations_url":"https://api.github.com/users/KrissMu/orgs","repos_url":"https://api.github.com/users/KrissMu/repos","events_url":"https://api.github.com/users/KrissMu/events{/privacy}","received_events_url":"https://api.github.com/users/KrissMu/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"Dhilan007","id":5234286,"avatar_url":"https://avatars.githubusercontent.com/u/5234286?v=3","gravatar_id":"","url":"https://api.github.com/users/Dhilan007","html_url":"https://github.com/Dhilan007","followers_url":"https://api.github.com/users/Dhilan007/followers","following_url":"https://api.github.com/users/Dhilan007/following{/other_user}","gists_url":"https://api.github.com/users/Dhilan007/gists{/gist_id}","starred_url":"https://api.github.com/users/Dhilan007/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Dhilan007/subscriptions","organizations_url":"https://api.github.com/users/Dhilan007/orgs","repos_url":"https://api.github.com/users/Dhilan007/repos","events_url":"https://api.github.com/users/Dhilan007/events{/privacy}","received_events_url":"https://api.github.com/users/Dhilan007/received_events","type":"User","site_admin":false},"milestone":null,"comments":2,"created_at":"2015-02-01T15:19:19Z","updated_at":"2015-02-02T09:45:45Z","closed_at":null,"body":"Hi,\r\n\r\nI'm trying to use image based fonts (with a PNG and the associated .fnt file) and to display text containing accents with it.\r\n\r\nIt does not work, the labels are not shown at all.\r\nAfter investigation, I found that setString() calls StringUtils::UTF8ToUTF16() that will consider the accent as invalid character (in ConvertUTF.c) since its ASCII value is not in the range of 0x80 - 0xC2 (128 - 194).\r\n\r\nThanks"},"comment":{"url":"https://api.github.com/repos/cocos2d/cocos2d-x/issues/comments/72429340","html_url":"https://github.com/cocos2d/cocos2d-x/issues/10321#issuecomment-72429340","issue_url":"https://api.github.com/repos/cocos2d/cocos2d-x/issues/10321","id":72429340,"user":{"login":"KrissMu","id":9886322,"avatar_url":"https://avatars.githubusercontent.com/u/9886322?v=3","gravatar_id":"","url":"https://api.github.com/users/KrissMu","html_url":"https://github.com/KrissMu","followers_url":"https://api.github.com/users/KrissMu/followers","following_url":"https://api.github.com/users/KrissMu/following{/other_user}","gists_url":"https://api.github.com/users/KrissMu/gists{/gist_id}","starred_url":"https://api.github.com/users/KrissMu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KrissMu/subscriptions","organizations_url":"https://api.github.com/users/KrissMu/orgs","repos_url":"https://api.github.com/users/KrissMu/repos","events_url":"https://api.github.com/users/KrissMu/events{/privacy}","received_events_url":"https://api.github.com/users/KrissMu/received_events","type":"User","site_admin":false},"created_at":"2015-02-02T09:45:45Z","updated_at":"2015-02-02T09:45:45Z","body":"I can't provide full code, but this should behave the same that mine:\r\n\r\n    auto label = cocos2d::Label::createWithBMFont(\"fonts/futura-48.fnt\", \"Démarrer\");\r\n\r\nIt will call:\r\n- Label::setString\r\n    - StringUtils::UTF8ToUTF16\r\n        - UTF8ToUTF16\r\n            - llvm::ConvertUTF8toWide\r\n                - ConvertUTF8toUTF16\r\n                    - isLegalUTF8\r\n\r\nThe last will return false while processing the \"é\" character.\r\n\r\n    case 3: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return false;\r\n\r\nThe hex code for \"é\" is 233, the code uses the table \"trailingBytesForUTF8\", maybe the problem is related to this."}}