V for Vincent Posted March 5, 2008 Share Posted March 5, 2008 Hi there, I'm currently working on a page that gathers information for a year book. People answer a few questions (the answers are added to a plain text file), upload their own picture if they so choose, etc... Got most of it working at the moment, but as the page is in Dutch, diacritic signs should be properly handled. The page itself has UTF-8 encoding, as does the text file containing the answers and yet, if I try to add a tilde to my name, for instance, I get ñ in the text file. Is there any way to remedy this? Link to comment Share on other sites More sharing options...
justsomeguy Posted March 5, 2008 Share Posted March 5, 2008 It might just be that whatever you're viewing the text file in doesn't support the encoding, but if you're using any string functions on the input make sure you're using the multibyte versions.http://www.php.net/manual/en/ref.mbstring.php Link to comment Share on other sites More sharing options...
V for Vincent Posted March 5, 2008 Author Share Posted March 5, 2008 Apparently that's not what's causing this. It's odd. I've created a stripped-down version of my page, even implemented other people's working code and it still doesn't work for me. Take this, for instance: <?php$myString = "Test with accents éèàç";$fh=fopen('test.txt',"w");fwrite($fh,utf8_encode($myString));fclose($fh);?> Even that doesn't work. Could it be a server thing? Sure hope not, though... It's not my own server.(though apparently, it doesn't work on my local test server either) Link to comment Share on other sites More sharing options...
justsomeguy Posted March 5, 2008 Share Posted March 5, 2008 That does work for me, but different text editors show different things. ConTEXT, which doesn't have very good support for UTF, shows incorrect text. Notepad shows the correct characters. Web browsers show incorrect characters. I'll send you a private link to the phpinfo script on my server for you to compare settings, in particular check the settings for the mbstring module. Link to comment Share on other sites More sharing options...
V for Vincent Posted March 6, 2008 Author Share Posted March 6, 2008 Hey, thanks. Installing the extension did the trick. Strangely, I had to omit the utf8_encode operation for the above snippet to work after I had installed the extension, but finding out why that is isn't really that high on my priority list. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.