1

I have a .txt file that looks like this:

SamAccountName         : spiderman
Name                   : Parker, Peter
LastLogonDate          : 8/22/2019 6:08:17 AM
LastBadPasswordAttempt : 8/22/2019 11:30:58 AM
AccountExpires         : 0

SamAccountName         : ironman
Name                   : Stark, Tony
LastLogonDate          : 8/17/2019 8:39:51 AM
LastBadPasswordAttempt : 5/30/2019 4:59:39 AM
AccountExpires         : 0

SamAccountName         : captainamerica
Name                   : Rogers, Steve
LastLogonDate          : 8/19/2019 2:49:05 AM
LastBadPasswordAttempt : 6/24/2019 1:30:17 AM
AccountExpires         : 0

SamAccountName         : thor
Name                   : Odinson, Thor
LastLogonDate          : 7/25/2019 1:36:11 AM
LastBadPasswordAttempt : 7/25/2019 1:30:35 AM
AccountExpires         : 0

I now want to display that on my website as it is using PHP. I managed to do that, but somehow there always are those two unknows symbols and I don't know how to make what they mean, why they are there and how I can remove them. This is my code:

<!DOCTYPE html>
<html>

<body>
    <form action="" method="post" class="formbody">
    <div class="codetable">
    <?php
    $file = 'c:\marvel\display.txt';
    $f = fopen($file, "r") or exit("Unable to open file!");
    while(!feof($f))
    {
        echo fgets($f)."<br />";
    }
    fclose($f);
    ?>
    <div class="codelabel"> 
    </div>
    </div>
    </form>
</body>
</html>

Here are the unknown symbols I get:

enter image description here

Or is there another (better) way to display it?

verfluecht
  • 493
  • 6
  • 24

1 Answers1

1

Seems like your .txt file is encoded with a wrong format. Try to create a new .txt file manually. You will need it encoded with ANSI.

verfluecht
  • 493
  • 6
  • 24
Snoopy111
  • 212
  • 4
  • 13