How to add Japanese text?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
How to add Japanese text?
I want to create an iOS game that is able to be played in English and Japanese (and possibly another language or two, but that's beside the point of this post). Whenever I've tried to type in Japanese or paste Japanese text into anything displayed to the user, the characters (the kana as well as the kanji) have come up as question marks. Is there any way I can add Japanese text to the game, or will I have to just create tiny images of each character and import them into the game?
Also, haha, how do I bring images into LiveCode? I'm completely new to the software, as in I haven't done anything beyond creating cards, buttons, and text fields with little to no function. Basically, I have to get good at the software really quickly. Luckily, I'm only in high school, so I have few obligations during the day, but I only have - at the most - a couple of months to have my game done.
Also, haha, how do I bring images into LiveCode? I'm completely new to the software, as in I haven't done anything beyond creating cards, buttons, and text fields with little to no function. Basically, I have to get good at the software really quickly. Luckily, I'm only in high school, so I have few obligations during the day, but I only have - at the most - a couple of months to have my game done.
Re: How to add Japanese text?
Hi,
Where do you get the Japanese text from? Do you have the Japanese language pack installed (on Mac it is called something like Asian Language Support and you have to install it from your OSX installation disk).
You can add images in several way. For example, copy an image and paste it into LiveCode or drag an image object from the tools palette and use the properties inspector to set its filename or import an image using he Import As Control or the Import As Referenced Control submenus in the File menu.
Kind regards,
Mark
Where do you get the Japanese text from? Do you have the Japanese language pack installed (on Mac it is called something like Asian Language Support and you have to install it from your OSX installation disk).
You can add images in several way. For example, copy an image and paste it into LiveCode or drag an image object from the tools palette and use the properties inspector to set its filename or import an image using he Import As Control or the Import As Referenced Control submenus in the File menu.
Kind regards,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Re: How to add Japanese text?
Hi bicobalt,
welcome to the forum!
Please check these stacks, great learning resources:
http://www.runrev.com/developers/lesson ... nferences/
Best
Klaus
welcome to the forum!

Please check these stacks, great learning resources:
http://www.runrev.com/developers/lesson ... nferences/
Best
Klaus
Re: How to add Japanese text?
Actually, now that I think about it, I don't have it on the Mac I use. I do have the setup necessary to type in Japanese on the Windows PC I use; so far I've just used Google Translate for the bulk of the text I've tried to incorporate and fudged in the rest using copied-and-pasted characters from Japanese Wikipedia. Yes, I do speak Japanese well enough not to need Google Translate, but it's a quick way to get the bulk of each sentence down before fine-tuning it.Mark wrote:Hi,
Where do you get the Japanese text from? Do you have the Japanese language pack installed (on Mac it is called something like Asian Language Support and you have to install it from your OSX installation disk).
You can add images in several way. For example, copy an image and paste it into LiveCode or drag an image object from the tools palette and use the properties inspector to set its filename or import an image using he Import As Control or the Import As Referenced Control submenus in the File menu.
Kind regards,
Mark
Since I have no idea where the installation disk is, I think from now on I'll just write out everything I want to on my Windows PC in a Word document and then export it. All of this is a stilted and crude system, but someday I'll have something better.
...That is, if the Japanese text won't just come in as question marks anyway...
Re: How to add Japanese text?
Hi,
You can't display Japanese text in LiveCode on OSX if the Japanese language pack isn't installed, evenif you write it in a Word file on Windows first. If you're using Lion, then your "install disk" is the Lion installer in the applications folder.
Kind regards,
Mark
You can't display Japanese text in LiveCode on OSX if the Japanese language pack isn't installed, evenif you write it in a Word file on Windows first. If you're using Lion, then your "install disk" is the Lion installer in the applications folder.
Kind regards,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Re: How to add Japanese text?
Hello!
I am also having trouble displaying Japanese text on the toast messages of my iPad app.
I can display Spanish and French texts, but when I try Japanese, it displays correctly on the screen, but not on toasts messages. What could be the problem?
Thanks,
Genie
I am also having trouble displaying Japanese text on the toast messages of my iPad app.
I can display Spanish and French texts, but when I try Japanese, it displays correctly on the screen, but not on toasts messages. What could be the problem?
Thanks,
Genie
Re: How to add Japanese text?
Hi Genie,
What are toasts messages?
Kind regards,
Mark
What are toasts messages?
Kind regards,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Re: How to add Japanese text?
Oh sorry, toast is probably for android. I mean, popup messages / answer dialog boxes.genie wrote:Hello!
I am also having trouble displaying Japanese text on the toast messages of my iPad app.
I can display Spanish and French texts, but when I try Japanese, it displays correctly on the screen, but not on toasts messages. What could be the problem?
Thanks,
Genie
Re: How to add Japanese text?
Hi Genie,
A possible way is to set the unicodeText of a hidden field to a variable containing UTF16 and get the htmlText of that field:
The dialog should display your Japanese text now.
Kind regards,
Mark
A possible way is to set the unicodeText of a hidden field to a variable containing UTF16 and get the htmlText of that field:
Code: Select all
put the htmlText of fld "Unicode" into myHtml
answer warning myHtml with "OK"
Kind regards,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Re: How to add Japanese text?
Thanks Mark! I'm gonna try that out.Mark wrote:Hi Genie,
A possible way is to set the unicodeText of a hidden field to a variable containing UTF16 and get the htmlText of that field:
The dialog should display your Japanese text now.Code: Select all
put the htmlText of fld "Unicode" into myHtml answer warning myHtml with "OK"
Kind regards,
Mark
Re: How to add Japanese text?
Hello Mark,genie wrote:Thanks Mark! I'm gonna try that out.
My strings are actually in a database. To get the strings, I do...
Code: Select all
function getErrorMessage tErrorID
databaseConnect
put getDatabaseID() into tDatabaseID
revExecuteSQL tDatabaseID, "SET NAMES 'utf8'"
put "SELECT dictionaryDefinition"&thelanguage&" FROM dictionaryContents WHERE dictionaryID='"&tErrorID&"'" into tSQL
put revDataFromQuery("|",return,tDatabaseID,tSQL) into tRecords
if length(tRecords) > 0 then
put uniencode(tRecords,"UTF8") into tData
set the unicodeText of field "errorfield" of card "topcard" of stack "Genie" to tData
return field "errorField" of card "topcard" of stack "Genie"
end if
end getErrorMessage
Tried what you said...
I replaced
Code: Select all
return field "errorField" of card "topcard" of stack "Genie"
Code: Select all
return the htmlText of field "errorfield" of card "topcard" of stack "Genie"
e.g. <p>キャン</p>
These lines are probably causing some conflicts?
Code: Select all
revExecuteSQL tDatabaseID, "SET NAMES 'utf8'"
put uniencode(tRecords,"UTF8") into tData
Re: How to add Japanese text?
Hi Genie,
Do the Japanese characters show up corectly in a database manager like SQL Workbench or PhpMyAdmin?
What exactly do you use to display the message in the dialog? Please post the syntax.
Is this MySQL or SQLite?
You can't use the SET NAMES command with UTF8, because LiveCode always sends queries in plain text. I'm not sure it helps, but you could try setting the query encoding to the default encoding of your platform, either Latin1 or MacRoman. Otherwise, use DEFAULT.
Probably, the problem is that LiveCode can't communicate in anything other than the client computer's default encoding if using the built-in database driver. I tried to find more info about this in the latest release notes, but couldn't find any. I have a php-based commercial custom solution, which solves this. It works with MySQL and if necessary I can adjust it for SQLite. Go to http://qery.us/3fk for an example. The command line window is a LiveCode stack.
Kind regards,
Mark
P.S. Please don´t quote a message if the quoted text is from only 1 message earlier.
Do the Japanese characters show up corectly in a database manager like SQL Workbench or PhpMyAdmin?
What exactly do you use to display the message in the dialog? Please post the syntax.
Is this MySQL or SQLite?
You can't use the SET NAMES command with UTF8, because LiveCode always sends queries in plain text. I'm not sure it helps, but you could try setting the query encoding to the default encoding of your platform, either Latin1 or MacRoman. Otherwise, use DEFAULT.
Probably, the problem is that LiveCode can't communicate in anything other than the client computer's default encoding if using the built-in database driver. I tried to find more info about this in the latest release notes, but couldn't find any. I have a php-based commercial custom solution, which solves this. It works with MySQL and if necessary I can adjust it for SQLite. Go to http://qery.us/3fk for an example. The command line window is a LiveCode stack.
Kind regards,
Mark
P.S. Please don´t quote a message if the quoted text is from only 1 message earlier.
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Re: How to add Japanese text?
Hi Mark!
This is SQLite, and yeah, Japanese texts appear correctly on 'SQLite Database Browser'.
Thanks,
Genie
This is SQLite, and yeah, Japanese texts appear correctly on 'SQLite Database Browser'.
Thanks,
Genie
Re: How to add Japanese text?
Hi Genie,
Tim Selander recently posted the follow script to the mailing list. He does use SET NAMES and this might help you.
For testing, you might want to change the last line into
Let me know if this works for you.
Kind regards,
Mark
Tim Selander recently posted the follow script to the mailing list. He does use SET NAMES and this might help you.
Code: Select all
on mouseUp
global vDatabaseID --database ID
--magic command for UTF8/mySQL, from forum user "bancock
--without this I cannot send or receive UTF8 from mySQL
revExecuteSQL vDatabaseID, "SET NAMES 'utf8'"
--fld "query" contains SQL query, English & Japanese text
put the unicodeText of field "query" into locSQLParams
put uniDecode(locSQLParams, "UTF8") into locSQLParams
put revDataFromQuery(, , vDatabaseID, locSQLParams) into myResult
--fld "queryresults" holds data returned by mySQL
--works great; get a field that shows the returned English and Japanese
set the unicodetext of fld queryresults to uniEncode(myResult, "UTF8")
--adding "unicodetext" to any part of "dgtext of group results causes error
--following line does NOT work. Japanese text is broken in datagrid
set the dgText of group "results" to uniEncode(myResult, "UTF8")
end mouseUp
Code: Select all
set the unicodeText of fld 1 to uniEncode(myResult,"UTF8")
Kind regards,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Re: How to add Japanese text?
I'm gonna look into this, Mark. Thanks much!