czwartek, stycznia 18, 2007

Problemy z PHP:

Strings - A string is series of characters. In PHP, a character is the same as a byte, that is, there are exactly 256 different characters possible. This also implies that PHP has no native support of Unicode. See utf8_encode() and utf8_decode() for some Unicode support.

Pozostaje jeszcze funkcja iconv w php.

Super strona o kodowaniu w UTF-8:

  1. http://www.kurshtml.boo.pl/generatory/unicode.html - świetnie pokazuje dowolny znak z Unicode
  2. http://www.jbrowse.com/text/charsets.html
  3. http://pl.wikipedia.org/wiki/ISO_8859-2 - w tym kodzie nie ma miejsca dla znaku € (domyślnie to 128, ale takiego znaku nie ma, jest niedopuszczalny). Hopteza - przy transmisji następuje najpierw spakowanie znaków po stronie klienta do kodu UTF-8, transmisja po sieci i rozpakowanie z UTF-8 na domyślny kod, ale ponieważ w danym alfabecie tego znaku nie ma to zastępowany jest znacznikem HTML €. Jest to potwierdzone w bazie Informix.
  4. http://osiolki.net/faq/kodowanie - dane o kodowaniu
  5. Deklaracja - Tag meta Deklarację użytego zestawu znaków powinno się wysyłać bezpośrednio w nagłówkach serwera (poza dokumentem), ale najczęściej autorzy stron nie mają takiej możliwości. Z tego powodu powstał tag <meta>.Deklarację należy umieścić w sekcji <head>. Dla kodowania ISO wygląda tak:<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-2">
  6. W PHP jest funkcja header() wysyłająca nagłówki HTTP.

    <?php header("Content-Type: text/html; charset=ISO-8859-2"); ?>

    Taka deklaracja zastępuje tag <meta>.

  7. W JavaServer Pages (nie myl z apletami Java ani JavaScript) kodowanie ustawia się następująco:

    <%@ page contentType="text/html" pageEncoding="UTF-8" %>

  8. Do kodowania i innej zabawy - http://www.gzegzolka.com/

  9. Dziwactwa IE - http://www.howtocreate.co.uk/wrongWithIE/ wiele ciekawych porównań

  10. Przewijanie:<DIV ID="oID_1" STYLE="overflow:scroll; height=200; width=150; text-align:left">The <B>scrollHeight</B> property is read-only, allowing
    you to obtain the height actually needed in the scrolling. Even though the height of this <B>DIV</B> is 200, the
    height inside the scrolling text box may be less, since the wrapping of the text may mean that not the entire
    width of the object is used. This dimension may be useful for a variety of reasons; for example,
    the height of the <B>DIV</B> could be set to the <B>scrollHeight</B> to conserve horizontal space while respecting the
    set width as a maximum. </DIV> i skrypt <
    SCRIPT>function fnCheckScroll(){ var newheight = oID_1.scrollHeight; alert("The value of the scrollHeight property is " + newheight + " pixels");}</SCRIPT>

  11. object.scrollTop

  12. Zdarzenia - Workaround: If your script is unable to rely on older event models, use a combination of addEventListener and attachEvent, and fall back to older models. Use
    if( theElement.addEventListener ) {
    theElement.addEventListener('click',myfunction,false);
    } else if ( theElement.attachEvent ) {
    theElement.attachEvent('click',myfunction);
    } else {
    theElement.onclick = myfunction;
    }

Brak komentarzy: