Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 372901
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T14:15:20+00:00 2026-05-12T14:15:20+00:00

When I try to open a .log file created by a game in PHP

  • 0

When I try to open a .log file created by a game in PHP I get a bunch of this.

ÿþ*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*�*� �
K�2� �E�n�g�i�n�e� �s�t�a�r�t� �u�p�.�.�.� �
[�2�0�0�9�/�2�2�/�0�9�]� �
[�1�6�:�0�7�:�3�3�]� �
[�0�.�1�.�4�6�.�0�]� �
[�0�]� �

I have no idea as to why? My code is

$file = trim($_GET['id']);
$handle = @fopen($file, "a+");

    if ($handle) {
        print "<table>";
        while (!feof($handle)) {
            $buffer = stream_get_line($handle, 10000, "\n");
            echo "<tr><td width=10>" . __LINE__ . "</td><td>" . $buffer . "</td></tr>";
        }
        print "</table>";

fclose($handle);

I’m using stream_get_line because it is apparently better for large files?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T14:15:21+00:00Added an answer on May 12, 2026 at 2:15 pm

    PHP doesn’t really know much about encodings. In particular, it knows nothing about the encoding of your file.

    The data looks like UTF-16LE. so you’ll need to convert that into something you can handle – or, since you’re just printing, you can convert the entire script to output its HTML as UTF-16LE as well.

    I would probably prefer converting to UTF-8 and using that as the page encoding, so you’re sure no characters are lost. Take a look at iconv, assuming it’s available (a PHP extension is required on Windows, I believe).

    Note that regardless of what you do, you should strip the first two characters of the first line, assuming the encoding is always the same. In the data you’re showing, these characters are the byte order mark, which tells us the file’s encoding (UTF-16LE, like I mentioned earlier).

    However, seeing as how it appears to be plain text, and all you’re doing is printing the data, consider just opening it in a plain old text editor (that supports Unicode). Not knowing your operating system, I’m hesitant to suggest a specific one, but if you’re on Windows and the file is relatively small, Notepad can do it.

    As a side note, __LINE__ will not give you the line number of the file you’re reading, it will print the line number of the currently executing script line.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 186k
  • Answers 186k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Some suggestions: Add LastUpdatedTime/LastUpdatedIP/LastUpdatedName to all tables Consider a FolderFolders… May 12, 2026 at 5:10 pm
  • Editorial Team
    Editorial Team added an answer You can do it all in a query: SELECT 'Today… May 12, 2026 at 5:10 pm
  • Editorial Team
    Editorial Team added an answer One important point to note is that it is not… May 12, 2026 at 5:10 pm

Related Questions

I have just stumbled across the Backgroundworker object, and it seems like the tool
I have an MDF file and no LDF files for a database created in
I created and deployed a package to SQL Server 2005. The package basically downloads
I compile my application on a windows XP SP3 machine. When it compiles, I
I'm trying to subclass the built-in file class in Python to add some extra

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.