> Is there a way to convert a string to unicode utf-16?

Apparently not built into php, which sort of surprises me..

You could make one if you want, it's not hard. It's just a bunch of
shifting, testing, and adding, and the algorithm is very straightforward.
Just be aware that recognizing the long forms of short encodings is a
security risk. (Check that a three byte sequence doesn't yield a code
point that should be represented in a one or two byte sequence.)

Hmm. Looking at the character handling available, maybe it's not as
straightforward as I thought. (I keep forgetting php is not C. 8-/)
Unpack dumps its result into a hash, which seems like a little too much
work to me. However, strncmp() and substr() should do in a pinch. 

However, I'm not sure why you would want to.

> The reason I want to do this is to use greek fonts in bookmars in pdf files
> generated by pdflib. This is done only by utf-16 characters.

What are you feeding the text to?

Web browsers and many other applications recognize UTF-8 without
problems, particularly if you tell them in advance that it's UTF-8.

> I know there is a utf8_encode() function. What about a utf16_encode? I found
> something about iconv but it is too complicated to use (since I work on
> windows and not on linux). Can someone help?

If you REALLY REALLY REALLY want a conversion function, I might be able
to build one for you next week. But I don't think you want one. Try this
instead:

    header( 'Content-Type: text/html; charset=UTF-8' );

-- 
Joel Rees, programmer, Kansai Systems Group
Altech Corporation (Alpsgiken), Osaka, Japan
http://www.alpsgiken.co.jp


-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to