Re: Characters in an uploaded text file being corrupted

"Jacob Kruger" <[email protected]>
Newsgroups gmane.comp.php.windows
Message-ID <3B7431D51F954CC695EE10179D2D49F3@jakesPC>
Ok, and, FWIW, this test text file is a word document that have saved as a 
text file, and when now resaved it using specifically unicode encoding, it 
seemd to eliminate this issue, but would have thought there might be a 
relatively simple way to handle something like encoding conversion in PHP 
itself..?

Stay well

Jacob Kruger
Blind Biker
Skype: BlindZA
'...fate had broken his body, but not his spirit...'

----- Original Message ----- 
From: "Jacob Kruger" <[email protected]>
To: <[email protected]>
Sent: Sunday, May 27, 2012 11:22 AM
Subject: [PHP-WIN] Characters in an uploaded text file being corrupted


Using the following bit of code, I am then saving the contents of an 
uploaded text file into a mysql database, but, the issue seems to be that 
immediately after retrieving the contents of the temporary path of the 
uploaded file, for example, things like ' characters are rendering as ? 
characters in the assigned variable..?

//start of code segment
if (isset($_FILES["filContent"])) {
if ($_FILES["filContent"]["type"] == "text/plain") {
$ltContents = file_get_contents($_FILES["filContent"]["tmp_name"]);
}
}
//end of code segment

I am guessing that it's either due to something to do with upload part of 
process - form tag is using post method, and has enctype set to 
multipart/form-data - or else, it might have something to do with the server 
handling character encoding or something..?

This is currently being run/tested under WAMP, on a windows7 64 bit machine, 
FWIW.

Stay well

Jacob Kruger
Blind Biker
Skype: BlindZA
'...fate had broken his body, but not his spirit...'


-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.