# A tutorial on using international characters in dynamic textfields

**URL:** <https://forum.kirupa.com/t/a-tutorial-on-using-international-characters-in-dynamic-textfields/505>\
**Category:** flash\
**Created:** [July 19, 2002, 6:54pm UTC](https://forum.kirupa.com/t/a-tutorial-on-using-international-characters-in-dynamic-textfields/505 "2002-07-19T18:54:10Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ptolemy](https://avatars.discourse-cdn.com/v4/letter/p/b38774/32.png) [@ptolemy](https://forum.kirupa.com/u/ptolemy)\
**Post date:** [July 19, 2002, 6:54pm UTC](https://forum.kirupa.com/t/a-tutorial-on-using-international-characters-in-dynamic-textfields/505/1 "2002-07-19T18:54:10Z")

</div>

[–BEGIN EDIT–]  
According to Macromedia,

```auto

System.UseCodePage=true; 

```

will ensure that all international characters will be properly rendered. I tried this with MX and it works fine. Go ahead and read how to do it the long way below but now that I know this method, I’m sitcking with it!

I feel like a fool now 🙂  
[–END EDIT–]

Ever tried importing text from an external file that contained international characters just to find that when testing your SWF, the accents and special characters didn’t render properly or even at all? Well, for those of you who have, I feel your frustration. But there is no longer any need to fear as I have discovered a simple yet effective solution to this plague! 🙂

There are a few things to consider when you’re planning on including international characters in a dynamic text box. The first is the **formatting** and **encoding** of your external file. The second is the **method** you use to import the data from the file into your SWF.

1. [color=blue] **Format and encoding of the external file** [/color]

* * *

**Format**  
Formatting rules of a file containing variables with international characters are more strict than usual. This may seem a little strange but things will make sense later when I show you how to import the file into your SWF.

The first thing to know is that your file _must_ begin with the following line of code:

```auto

//!-- UTF-8

```

**n.b.** : _It is important to conserve all spaces as demonstrated_

The second thing is to make sure your variables are properly declared. Unlike a file without international characters, the code

```auto

myvar = j'étire mes jambes

```

will have your SWF complaining that you have a syntax error. The reason for this is that we will make use of the _#include_ function to import our variables. Because _#include_ parses syntax-sensitive code, we must format our file like so:

```auto

myvar = "j'étire mes jambes";

```

It makes sense to do things this way and in fact, I prefer declaring variables this way - it just makes things cleaner :).

**Encoding**  
Unlike the norm, files containing international characters _must_ be saved using **UTF-8** encoding. I know for a fact that this can be done with Notepad but I’m confident that any text editor can do this as well. To save a file with UTF-8 encoding in Notepad, simply select _Save-as_ and change the _Encoding-type_ to _UTF-8_. That’s it.

So to recap on formatting, here’s how a ‘well-formed’ text file would look like:

```auto

//!-- UTF-8
myvar = "j'étire mes jambes";

```

1. [color=blue] **Importing your international text file into your SWF** [/color]

* * *

I am assuming that you already know how to properly setup a dynamic textfield to recieve external data so if you are unsure about this, take a look in the forums and you will surely find an answer.

Now this couldn’t be easier. Instead of using the usual _loadVariables()_ function, we will use the _#include_ command. Let’s say the file that contained the text we wanted in our dynamic textfield was located in the file c:/temp/test.txt. We would then put the following line in the movie clip (or \_root) where the textfield existed:

```auto

#include "c:/temp/test.txt"

```

**n.b.** : _I intentionally omitted the semi-colon from the end of the line. Flash will complain that you have a malformed #include statement if you decide to do otherwise._

And that’s it. Simple huh? Seems a little strange that Flash doesn’t include support by default for all ASCII characters. I know how much frustration this caused me and am just glad now to have a solution. I hope this was as relieving to me as it was to you. 🙂

Cheers,  
ptolemy

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 19, 2002, 7:45pm UTC](https://forum.kirupa.com/t/a-tutorial-on-using-international-characters-in-dynamic-textfields/505/2 "2002-07-19T19:45:08Z")

</div>

Nice 🙂

pom :asian:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 20, 2002, 7:13pm UTC](https://forum.kirupa.com/t/a-tutorial-on-using-international-characters-in-dynamic-textfields/505/3 "2002-07-20T19:13:34Z")

</div>

Hey ptolemy,  
That is an interesting read. Would it be possible for me to use your info and make it into a tutorial You will be given full credit of course 🙂

Cheers!  
Kirupa :asian:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 20, 2002, 7:28pm UTC](https://forum.kirupa.com/t/a-tutorial-on-using-international-characters-in-dynamic-textfields/505/4 "2002-07-20T19:28:26Z")

</div>

Go right ahead, I’d be honoured 🙂

–ptolemy

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 30, 2003, 1:03pm UTC](https://forum.kirupa.com/t/a-tutorial-on-using-international-characters-in-dynamic-textfields/505/5 "2003-01-30T13:03:22Z")

</div>

This is really a super thread. Thank you!

What I’ve been doing so far is to specifically embed the special characters. But I’ve run into a problem with that - I’m wondering if any of you have also come across this:

In the box where I add newly needed special characters, (ñ, é, etc in addition to others already specified), I click done, export the movie, and save the fla as usual.

However, when I close and then go back to the fla later, the additions are gone. I’m not sure it happens every time, but I’ve seen this in both Flash 5 and Flash MX.

Does anyone know a work-around?

Thanks  
Karen

PS… Does this tutorial also work on cryllic alphabets, such as polish or russian? Would I need to make any changes to the UTF specified?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 30, 2003, 5:03pm UTC](https://forum.kirupa.com/t/a-tutorial-on-using-international-characters-in-dynamic-textfields/505/6 "2003-01-30T17:03:38Z")

</div>

> \*Originally posted by kirupa \*  
> \*\*Hey ptolemy,  
> That is an interesting read. Would it be possible for me to use your info and make it into a tutorial You will be given full credit of course 🙂

Cheers!  
Kirupa :asian: \*\*

Don’t think that would necessary, IMHO. For Flash 5 maybe (even though there are many better ways of doing it), but for MX it’s as plain as day : System.UseCodePage = true.

Also remember that special characters, often used in languages other than English, do not translate through text files.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 21, 2003, 6:06am UTC](https://forum.kirupa.com/t/a-tutorial-on-using-international-characters-in-dynamic-textfields/505/7 "2003-10-21T06:06:26Z")

</div>

I am trying to integrate vietnamese, but it is not working.

I used both methods you guys suggested. I can see the text properly on the text file, but not on the .swf

Any suggestions?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 21, 2003, 8:22am UTC](https://forum.kirupa.com/t/a-tutorial-on-using-international-characters-in-dynamic-textfields/505/8 "2003-10-21T08:22:36Z")

</div>

This article is from [moock.org](http://moock.org), relates to the topic, so it might be of interest to you guys. It gets a little detailed by worth a read.

> The System.useCodePage property is suggested by many as a magical cure to character display problems in Flash. Unfortunately, while useCodePage may appear to fix a problem on a single machine, it can create problems on others. This technote is an excerpt from [ASDG2 explaining why you should avoid System.useCodePage unless you know _exactly_ what you’re doing. If you just want to use a special character in Flash and you are exporting to Flash Player 6 or later, you should [URL=http://www.moock.org/asdg/technotes/usingSpecialCharacters/]follow these instructions](http://www.moock.org/asdg/buy/).

[Full article here](http://www.moock.org/asdg/technotes/againstUseCodePage/)
