4 Replies Latest reply on Jan 7, 2011 4:38 AM by JonoB

    unicodeRange

    JonoB Level 1

      I have a flex application, where the font style has been set as follows:


      @font
      -face {
        fontFamily
      : Arial;
        fontWeight
      : normal;
        fontStyle
      : normal;
        src
      : local("Arial");
        unicodeRange
      : U+0021-U+007E,
        U
      +a3-U+a3;
      }

      The unicode range of U+a3 allows users to enter the £ (British Pound sign).

       

      When entering this data in flex and saving to the database, the £  sign gets prepended with some weird characters like "Âã". I  debugged the flex app, and stopped code on the save action, and the  offending control indeed shows the weird characters in the save  variable. So, the error seems to be created on the flex side.

       

      I then changed the font as follows, removing any unicode references

      @font-face {
        fontFamily
      : Arial;
        fontWeight
      : normal;
        fontStyle
      : normal;
        src
      : local("Arial");
      }

      This seems to improve it somewhat, but the data is now saved as "£".  Stepping through the code shows that the character is only being sent  through to the server as a £, so it would seems that the error is now  created on the database side

       

      I'm probably missing something obvious here. Ideally I'd like to keep the unicode range as small as possible.

        • 1. Re: unicodeRange
          JonoB Level 1

          I have also tried settings the unicodeRange as follows:

          @font-face {
              fontFamily: Arial;
              fontWeight: normal;
              fontStyle: normal;
              src: local("Arial");
              unicodeRange: U+0021-U+007E,
              U+00A3-U+00A3;
          }

           

          This results in a moderate improvement, although the item is still getting saved as £

          • 2. Re: unicodeRange
            JonoB Level 1

            Having stumbled upon a similar question at MySQL or PHP is appending a  whenever the £ is used, I realised that its completely correct that the DB is saving the item as £.

             

            Importantly, however, the unicodeRange must be U+00A3-U+00A3 and not U+a3-U+a3

            • 3. Re: unicodeRange
              Gregory Lafrance Level 6

              You might want to check to see what encoding your database is set to use.

               

              This post is similar: http://discussion.forum.nokia.com/forum/showthread.php?150522-Unicode-characters-and-%C3%8 2

               

              I think you want to have it set to use UTF-8, not ISO-8859-1.

               

              If this post answers your question or helps, please mark it as such. Thanks!

              http://www.stardustsystems.com
              Adobe Flex Development and Support Services

              • 4. Re: unicodeRange
                JonoB Level 1

                Hi Greg,

                 

                Thanks for the response.

                 

                My database is indeed encoded in UTF-8. I'm almost there, but not quite.

                 

                1. I am running a flex front end, with a php + mysql backend

                2. When I save a record from flex, the string gets sent to the server as "This amount is £10"

                3. php views the string as above, and when it gets saved into the DB, it gets saved as "This amount is £10". My understanding is that this is all correct

                4. I now retrieve the above record, and it gets sent to flex as "This amount is £10". Flex correctly displays this in a textarea as  "This amount is £10"

                5. I change another field in the same record in flex, and re-save the transaction. The string now gets sent to the server as "This amount is £10"

                6. The record is now saved into the DB as "The amount is £10"

                 

                This is obviously incorrect...any ideas on how to get around this would be appreciated.