10 Replies Latest reply on Aug 28, 2012 1:07 AM by DAVID NAJAR

    Text problems

    thomas_th21 Level 1



      I'm working in director since 2 weeks and learn bit by bit new parts.

      Now I have one problem displaying text in my sprite.

      The situation is as follow:

      I read my data from a XML file (this is necessary because the text is variable and need to be easy editable)

      So I read my xml file in and process it to my sprite.

      The only problem I have is some special characters are not recognized and mess up my total text.


      Some of my code


      on UpdateSlideData (me,data)


        if voidp(data) then exit

        body = "<html><body bgcolor="&quote&"#FFFFFF"&quote&"><font color="&quote&"#2c2f64"&quote&" size="&quote&"4"&quote&" face="&quote&"Arial"&quote&">"

        lineHeights =[]

        previousLine =1

        txt = ""

        id = 1

        if voidp(data[#TCS]) then

          member("T_SlideOutputText").html = ""

          return data

        end if

        if data[#TCS] <> "" then

          repeat with i in data[#TCS]

            txtfromslide =  i[#data]


            case i[#type] of


              1,11:-- type 1 : normal title

                txt = txt&"<b>"&txtfromslide&"</b><br />"

              2,12:-- type 2 : -->

                txt = txt&"-> "&txtfromslide&"<br />"

              3,13:-- type 3 : VB

                txt = txt&" "&txtfromslide&"<br />"

              4,14:-- type4 : 4

                txt = txt&""&txtfromslide&"<br />"


                txt = txt&" "&"<br />"

            end case

            txt = me.cleanTxt(txt)

            txt =  gString.CleanRepeatedChar(txt)

            -- if txt[2] = true then alert ("error" &txt)

            txt = txt[1]


      on CleanRepeatedChar me,var

        if voidp(var) then return ["",true]

        repaired = false

        return [var,repaired]



      on cleanTxt me,txt

        if not voidp(txt) then

          if txt<>"" then

            txt = Str_regReplace("&apos;","'",txt)

            txt = Str_regReplace("&deg;","°",txt)

            txt = Str_regReplace(return,"<br />",txt)

            txt = Str_regReplace("\[br\]","<br />",txt)

            txt = Str_regReplace("&amp;","&",txt)

            txt = Str_regReplace("&apos;","'",txt)

            if myEditor=false then

              txt = gCdContent.CreateTxtHtml(txt)


              return txt

            end if


            --      txt = Str_regReplace("&amp;","&",txt)

            --      txt = Str_regReplace("\[br\]","<br />",txt)

            --      txt = Str_regReplace(return,"<br />",txt)

          end if

        end if

        return txt



      In the underlined code the special characters become unreadable.

      What is the solution to this problem ?

        • 1. Re: Text problems
          Sean_Wilson Adobe Community Professional

          Can you provide an example of what goes in, what comes out, and what's going wrong?

          • 2. Re: Text problems
            thomas_th21 Level 1

            I searched a little bit more on the problem I have.

            So the situation is as follow:

            I have a text sprite member on my stage (T_SlideOutputText)

            This is just my container for showing text. Now I put html data in it by member("T_SlideOutputText").html = (my html text) <htm><body>"blablabla"</body></html>

            Now the real problem is that for some characters (like é " ) it gives me in the html an invalid value.

            I looked deeper in the problem and now it seems that even getting my text from the xml giving me a problem.

            The moment I decrypt my xml file and try to read it the output is almost entirly correct except that some characters give me a question mark.

            I read the output when there was nothing done with the file (so just reading the file without parsing or anything else give me)




            How can just reading a file without doing anything give me a question mark ?

            This is offcourse the problem because that inforamtion will send to html so offcourse my html is not correct.

            (the question mark in the file is a ' )

            What can be the problem ?


            I tried enter these characters in html editor dreamweaver and there it is no problem showing these in the webbrowser.

            A solution is entering for these characters &quot; ... in the xml (that I read for entering in my html).

            But because there are a lot of different xml it is just not possible to replace all special characters.

            Now I think the problem needs to be in the html parser of Director. How does Director show the html ? What does it use for showing special characters ? Do I need special font embedding ?

            These are all question you practicly not find on the internet. Even the fonts are like hell in Director.

            P.S. When I start my project, Director tells me a font is missing and need to replace it by another font (can that be the problem)

            • 3. Re: Text problems
              Sean_Wilson Adobe Community Professional

              Which version of Director are you using?

              • 4. Re: Text problems
                thomas_th21 Level 1

                Adobe Director 11.5

                And I use the DataSafe Xtra for encrypting and decrypting my data.

                • 5. Re: Text problems
                  Sean_Wilson Adobe Community Professional

                  I don't know this xtra (DataSafe), but was it compiled for D11+, or for D10 and below? Otherwise, it won't be unicode aware and will perhaps struggle with high ASCII characters (which appears to be your problem). Where in your process is this xtra involved (you refer to decryption). Is there another xtra you could use? How dependent are you on encrypting/decrypting data? Have you tried another xtra, like Valentin's crypto xtra?

                  • 6. Re: Text problems
                    thomas_th21 Level 1

                    Yes I think it was compiled in a much older version of Director (I don't know wich but is certainly older than version 10).

                    The problem is that I need to rework some parts of the program  wich is wrote in 2007.

                    The  DataSafe extra is just need to decrypt and encrypt (I don't think the problem is there because the written encrypted data contains every value).

                    I think the unicode aware will most likely be the problem.

                    Do you know how I can solve this problem ?

                    • 7. Re: Text problems
                      Sean_Wilson Adobe Community Professional

                      Test a different xtra for encryption/decryption, like the one I suggested. Or try your program without encrypting/decrypting and see if this makes a difference (i.e. don't use the xtra)

                      • 8. Re: Text problems
                        DAVID NAJAR Level 1



                        Check if the XML header (<?xml version="1.0" encoding="UTF-8"?>) and XML file encoding is UTF-8. Many text editors set file encoding to ANSI (or other non UTF or Unicode format) by default. If you are working on Windows open your XML file in Notepad and “Save As” with UTF-8 encoding. I used to have the same problem some years ago. Buddy File is a great and easy file Xtra and has BlowFish encryption functions.


                        I hope this helps you.

                        • 9. Re: Text problems
                          thomas_th21 Level 1

                          Thank you very much !

                          It was indeed just saving the file in UTF-8.

                          Now I just need to figure out the encryption and then all the problems are solved.

                          I will try to use Buddy File

                          Again thank you very much (I would never found it)

                          • 10. Re: Text problems
                            DAVID NAJAR Level 1

                            My pleasure!!! Have a nice coding.