4 Replies Latest reply on Feb 21, 2012 6:47 PM by LyndsayHowarth

    encoding problem with apostrophes


      Hi All,


      I have an encoding problem with apostrophes using the PHP API to fetch a valuelist.


      The resulting valuelist contains some hospital names and some of those have apostrophes.


      Here is an extract of the raw results using print_r:


      => Royal Melbourne Hospital [13] => Royal WomenRoyal Women’s Hospital [14] => St VincentSt Vincent’s Private Hospital [15] =>


      The problem is that where the value contains an apostrophe is being chopped short at that point and then the entire value is repeated in a single value. If I use htmlspecialchars() on the resulting valuelist, the valuelist is empty.


      I have tried currly quotes () and foot marks (')... in the original field data...


      The apostraphe must be maintained or reinstated for data entry..


      ... not sure what else to try... any ideas?




      - Lyndsay



      Lyndsay Howarth (B. Ed)

      11th Hour Group Pty Ltd



        • 1. Re: encoding problem with apostrophes

          I haven't tested, but wouldn't the php functions addslashes() and stripslashes() be the ones to research?




          (& check the magic_quotes setting on your PHP config, of course, http://www.php.net/manual/en/function.get-magic-quotes-gpc.php ) - this is not just an FMP "problem" sometimes.


          htmlspecialchars() is quite different. http://gr2.php.net/manual/en/function.htmlspecialchars.php



          1 of 1 people found this helpful
          • 2. Re: encoding problem with apostrophes

            Hi Lyndsay,


            I remember having this exact same issue myself a few years ago now but I'm a bit fuzzy on the details now. I'm pretty sure you need to use htmlspecialchars from memory.


            What method are you using to retrieve the value list: getValueLists() or getValueListsTwoFields()?. getValueLists() has been deprecated so if you're using FileMaker Server v10/11 you're best off using the getValueListsTwoFields() method. Are you using the value list array to create an HTML select menu and if so can you post the PHP code so we can have a look?


            Here's an example from one of my forms:


            <label for="Problem">Problem:</label>

                                                              <select name="Problem">

                                <option value=""></option>

                  <?php foreach($problems as $problem) {$problem = htmlspecialchars($problem);?>

                  <option value="<?php echo $problem; ?>"><?php echo $problem; ?></option>






            I can track down the database and php pages that use a value list which has apostrophes in it if you're not getting anywhere . . . will have to wait until the morning though.





            FileMaker 8/9/10/11 Certified Developer


            - - - - - - - - - - - - - - - - -

            Phone: +61 2 9484 6565

            Mobile: +61 418 468 103

            Email: andrew@databuzz.com.au


            • 3. Re: encoding problem with apostrophes

              Nail on the head... thanks Andrew....

              (I did know this ;-) but knowing and remembering are 2 different things. I had been doing some work on an old v9 server and forgot to switch my version brain on when I was doing this work on an 11 server)

              databuzz wrote:




              Beverly, thanks for the suggestions but the problem always was the raw data coming out of FM was already corrupted.

              • 4. Re: encoding problem with apostrophes

                wow.. I just re-read my post from last night. I don't normally spell so badly: "apostraphe" !!!!