How do I handle characters from other spoken languages

Just started using Construct 2? Post your questions here

Post » Sat Jan 07, 2017 11:21 pm

Hi

I have been working on a personal project for myself to help me with learning French at the moment, when I copied a series of text data straight into the list properties within Construct 2 , the text displayed correct in French even when some of the letters had the various "accents" on them

Howver I have just spent some time reading in a text file using ajax and formating the separaters etc but when I feed the text data into a Text Label (Not an edit Text box) the "accents" show up as a diamond character. Does this mean that ajax is unable to handle these types of characters?
Regards

TimCS
B
23
S
8
Posts: 132
Reputation: 1,921

Post » Sun Jan 08, 2017 12:32 am

Hi,

I think the problem comes from the bad character encoding in your web page (the html document). Try using this :
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
If needed, modify the html file with a text editor such as Notepad++ or SublimeText and select "UTF8 without BOM" to make it work.

If this is not the solution, I really don't know how to help you ^^'
Hello !



I'm Steven, a 24 years old French graphic designer and programmer, and it's been 4 years since I started using Construct 2.
B
15
S
6
G
3
Posts: 70
Reputation: 2,573

Post » Sun Jan 08, 2017 10:15 am

Ratmaster wrote:Hi,

I think the problem comes from the bad character encoding in your web page (the html document). Try using this :
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
If needed, modify the html file with a text editor such as Notepad++ or SublimeText and select "UTF8 without BOM" to make it work.

If this is not the solution, I really don't know how to help you ^^'


@RatMaster thank you for your repy, where would I add this within the project files as when I build this project for Android and run it on an Android device it does the same thing. I am using phonegap to build this if that makes any difference.
Regards

TimCS
B
23
S
8
Posts: 132
Reputation: 1,921

Post » Sun Jan 08, 2017 2:11 pm

When exporting your project, you get a "www" folder, and in it you will find the "index.html" file
When you open it with a text editor such as SublimText, you will see the line "<meta charset="UTF-8" />" which is equivalent to what I wrote before (but you can still try to replace it, it might maybe help on some browser)

It seems Construct2 already encoded the file in UTF-8, so it's more probable there is a problem with the encoding of the text file you read with ajax, so you should try saving it with another encoding
In sublimText2, you use "File > Save with encoding" and you select your encoding (here UTF-8) It might mess up every accent in your document though, but it's the only way. (this software exists in a trial version you could use if needed)

I'm not an expert but I'm pretty sure the problem comes either from the fact that the web page's encoding is wrong and can't display the characters correctly, either from the fact that you try to load text from a file with ANOTHER encoding and the characters are not converted properly ^^' To avoid this kind of problem, you should always use the same character encoding in every file
Hello !



I'm Steven, a 24 years old French graphic designer and programmer, and it's been 4 years since I started using Construct 2.
B
15
S
6
G
3
Posts: 70
Reputation: 2,573

Post » Sun Jan 08, 2017 2:58 pm

Ratmaster wrote:When exporting your project, you get a "www" folder, and in it you will find the "index.html" file
When you open it with a text editor such as SublimText, you will see the line "<meta charset="UTF-8" />" which is equivalent to what I wrote before (but you can still try to replace it, it might maybe help on some browser)

It seems Construct2 already encoded the file in UTF-8, so it's more probable there is a problem with the encoding of the text file you read with ajax, so you should try saving it with another encoding
In sublimText2, you use "File > Save with encoding" and you select your encoding (here UTF-8) It might mess up every accent in your document though, but it's the only way. (this software exists in a trial version you could use if needed)

I'm not an expert but I'm pretty sure the problem comes either from the fact that the web page's encoding is wrong and can't display the characters correctly, either from the fact that you try to load text from a file with ANOTHER encoding and the characters are not converted properly ^^' To avoid this kind of problem, you should always use the same character encoding in every file


@Ratmaster
I firstly tried your inital suggestion with adding the html tag to the index.html with and without the existin meta tag line created by Construct 2 but that did not work.

On your second suggestion, are you refering to editting the file that containts the text data that has the language held in it? If so I will copy it first and try SublimText2 , also is this the only type of editor , as in is there a free one, that could do this?
Regards

TimCS
B
23
S
8
Posts: 132
Reputation: 1,921

Post » Sun Jan 08, 2017 3:08 pm

Yes, I'm talking about editing the file that contains the text data ;-) It's a good idea to make a copy first

You could also use Notepad++ which is entirely free, I mostly use SublimeText out of habit ^^
Hello !



I'm Steven, a 24 years old French graphic designer and programmer, and it's been 4 years since I started using Construct 2.
B
15
S
6
G
3
Posts: 70
Reputation: 2,573

Post » Sun Jan 08, 2017 4:50 pm

Ratmaster wrote:Yes, I'm talking about editing the file that contains the text data ;-) It's a good idea to make a copy first

You could also use Notepad++ which is entirely free, I mostly use SublimeText out of habit ^^


@Ratmaster - That worked using notepad++ by converting the file to UTF-8 saving it and then zipping up the folder to load into phonegap once built and installed, the French "accents" (I am sure you will correct me on that terminology :) ) are now showing.

Thank you for this RatMaster, it is just a case of remembering this when exporting the project next time if I add to this file or any other of these.

Now to continue with this project which has become quite a challenge :)
Regards

TimCS
B
23
S
8
Posts: 132
Reputation: 1,921

Post » Sun Jan 08, 2017 5:52 pm

I'm really glad I could help you :-D I had a similar problem in the past so I figured it could be the same for you ^^
No need to correct you, it's indeed called "accents" in French ;-)
Hello !



I'm Steven, a 24 years old French graphic designer and programmer, and it's been 4 years since I started using Construct 2.
B
15
S
6
G
3
Posts: 70
Reputation: 2,573

Post » Sun Jan 08, 2017 6:27 pm

Ratmaster wrote:I'm really glad I could help you :-D I had a similar problem in the past so I figured it could be the same for you ^^
No need to correct you, it's indeed called "accents" in French ;-)


Odd thing has happened here and I am wondering if it is to do with phonegap as it played up with the TTS plugin I have were it would not compile with it added in, however when I removed it and re-added it that worked.

However, with this Unicode file I have converted, I copied it to another folder, did some more additions to the project, exported the project, copied the convertered txt file into and overwritting the newly exported one, zipped it up, loaded it into phonegap (update code) re-built it installed but the characters are not showing correctly .

Maybe I have to re-convert the exported one everytime?

** EDIT ** yes is the answer to the above question :)
Regards

TimCS
B
23
S
8
Posts: 132
Reputation: 1,921

Post » Sun Jan 08, 2017 7:02 pm

yes that's the boring part if the software doesn't keep it :-/
Hello !



I'm Steven, a 24 years old French graphic designer and programmer, and it's been 4 years since I started using Construct 2.
B
15
S
6
G
3
Posts: 70
Reputation: 2,573

Next

Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 0 guests