Convert a letter into something else?

Discussion and feedback on Construct 2

Post » Thu Feb 09, 2017 12:26 am

Hi. I'm working on KlangMs localization system, and I'm noticing how loading .txt and .csv files corrupts certain letters like the ÆØÅ from the Norwegian alphabet. Even if I've verified they look correct in any text editor, it shows up as corrupted.

Here's two images showing the problem:

Image

Image

However writing these letters from construct works fine. So I'm wondering if there's any way to find these corrupt letters with some expression, and then replace it with a letter called upon within the editor like I'm showing in the second image?

Thanks!
B
35
S
10
Posts: 386
Reputation: 3,265

Post » Thu Feb 09, 2017 8:55 am

Tinimations wrote:Hi. I'm working on KlangMs localization system, and I'm noticing how loading .txt and .csv files corrupts certain letters like the ÆØÅ from the Norwegian alphabet. Even if I've verified they look correct in any text editor, it shows up as corrupted.

Here's two images showing the problem:

Image

Image

However writing these letters from construct works fine. So I'm wondering if there's any way to find these corrupt letters with some expression, and then replace it with a letter called upon within the editor like I'm showing in the second image?

Thanks!




The Only way I know is like this.

Image

A link to encoding

http://codebeautify.org/url-encode-string

or

http://www.w3schools.com/tags/ref_urlencode.asp

I don't know if it works with .csv, but works with .txt files
Bushy Ball\Boatman Bill\Sticky Web\Snake

Image ImageImageImage

During the gold rush it was a good time to be in the pick and shovel business
B
47
S
14
Posts: 253
Reputation: 5,389

Post » Thu Feb 09, 2017 9:19 am

@Tinimations

Be sure that you saved your text in utf-8 not in ascii. If this doesn't work you can additional try to override the MIME type:
text/plain; charset=utf-8

There is an override action in the ajax-plugin
B
24
S
3
G
1
Posts: 454
Reputation: 2,171

Post » Thu Feb 09, 2017 12:17 pm

@sizcoz Hmm couldn't get it to work. Changing the å into what the encoder suggested only made it print the encoded text to screen. It didn't convert into anything.

@Asmodean I tried both overriding and saving the text as UTF-8, however now the exported .csv now shows the "å" as "?" in the text file... No luck. A find and replace expression within Construct would fix this though.
B
35
S
10
Posts: 386
Reputation: 3,265

Post » Thu Feb 09, 2017 12:40 pm

Tinimations wrote:@sizcoz Hmm couldn't get it to work. Changing the å into what the encoder suggested only made it print the encoded text to screen. It didn't convert into anything.

@Asmodean I tried both overriding and saving the text as UTF-8, however now the exported .csv now shows the "å" as "?" in the text file... No luck. A find and replace expression within Construct would fix this though.


@Tinimations

http://www.sizzle-games.com/norwegian.capx

Works here chrome, firefox, edge, also works on android
Bushy Ball\Boatman Bill\Sticky Web\Snake

Image ImageImageImage

During the gold rush it was a good time to be in the pick and shovel business
B
47
S
14
Posts: 253
Reputation: 5,389

Post » Thu Feb 09, 2017 12:55 pm

Tinimations wrote:I tried both overriding and saving the text as UTF-8, however now the exported .csv now shows the "å" as "?" in the text file... No luck. A find and replace expression within Construct would fix this though.


try to override with:
text/csv; charset=utf-8

not with text/plain

If this doesn't work you could to it the other way around and save the text as ascii and override the mime type with:
text/csv; charset=ascii

I still think that is a character encoding problem.
B
24
S
3
G
1
Posts: 454
Reputation: 2,171

Post » Thu Feb 09, 2017 1:06 pm

@sizcoz Oh I see what I did wrong. It worked now. Thank you! :)
B
35
S
10
Posts: 386
Reputation: 3,265

Post » Thu Feb 09, 2017 1:13 pm

Tinimations wrote:@sizcoz Oh I see what I did wrong. It worked now. Thank you! :)


@Tinimations

There is probably a better alternative.

You could use "a" instead of "å" in your text file then replace all the "a"'s with "å"'s

code.

Text: Set Text to RegexReplace(text.Text,"a","g","å")

That will do it !
Bushy Ball\Boatman Bill\Sticky Web\Snake

Image ImageImageImage

During the gold rush it was a good time to be in the pick and shovel business
B
47
S
14
Posts: 253
Reputation: 5,389

Post » Thu Feb 09, 2017 1:25 pm

Well a is a very common letter in Norwegian as well so no I can't do that. What I'll rather do is I'll replace all "å" in the exported csv with the code with a find and replace feature before I import it into construct. It worked. Thanks for the tip though.
B
35
S
10
Posts: 386
Reputation: 3,265

Post » Thu Feb 09, 2017 1:29 pm

Tinimations wrote:Well a is a very common letter in Norwegian as well so no I can't do that. What I'll rather do is I'll replace all "å" in the exported csv with the code with a find and replace feature before I import it into construct. It worked. Thanks for the tip though.


No probs, notepad++ is good for that, and free.
Bushy Ball\Boatman Bill\Sticky Web\Snake

Image ImageImageImage

During the gold rush it was a good time to be in the pick and shovel business
B
47
S
14
Posts: 253
Reputation: 5,389

Next

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 8 guests