User forums > Help

Unable to read source file

<< < (3/8) > >>

BlueHazzard:
are the layout and project settings saved and restored correctly?
what if you rename the c file to txt file?
do you use some color scheme?
are you sure the file is displayed as empty, or is the text simply white on white? does the cursor move?

LuiZiffer:

--- Quote ---does i  happen with any text file or only with files you created with codeblocks?
--- End quote ---
   Any, regardless of how the file was created.

--- Quote ---what if you use some other encoding then utf8?
--- End quote ---
   I tried Windows-1252 and default, no changes.

--- Quote ---does the same problem arises with the windows exe of codeblocks on the same system, same file?
--- End quote ---
   No, the windows version can open any file without issue.

--- Quote ---are the layout and project settings saved and restored correctly?
--- End quote ---
   I'm sorry, I don't know how to determine that.

--- Quote ---what if you rename the c file to txt file?
--- End quote ---
   No changes.

--- Quote ---do you use some color scheme?
--- End quote ---
   No, everything is set to default. (Didn't change anything yet)

--- Quote ---are you sure the file is displayed as empty, or is the text simply white on white? does the cursor move?
--- End quote ---
   The file is empty -> pics: OpenSuse, Windows 10 (win10)

stahta01:
Could the problem be the BOM at the start of the UTF8 file?

Tim S.

LuiZiffer:
troubleshooting.txt contains the text "testing"

I tried:

--- Quote ---vi troubleshooting.txt
:set nobomb
:wq
--- End quote ---

and,

--- Quote ---sed -i $'1s/^\uFEFF//' troubleshooting.txt
--- End quote ---

without success

BlueHazzard:

--- Quote ---   I'm sorry, I don't know how to determine that.
--- End quote ---
Edit the Project->Build options
close the project reopen it and look if the changes are there...


i am out of ideas.... The file encoding seems to be working, but the file reading is the problem... But it can read the XML documents, because otherwise you would not be able to open the project so file access is not the problem...
I have looked into the code and you fail in the

--- Code: ---bool EncodingDetector::DetectEncoding(const wxByte* buffer, size_t size, bool convert_to_wxstring)
--- End code ---
function...
I am not quite sure what path the code goes...

--- Code: --- if (cfgMgr->ReadInt(_T("/default_encoding/use_option"), 0) == 1)
--- End code ---
is false, because you are not getting

--- Quote ---Warning: bypassing C::B's auto-detection!
--- End quote ---
so you go the mozilla detection route. There the first entry is

--- Code: ---if (!buffer)
            return false;
--- End code ---
so if buffer is a 0 pointer you will never continue, so the pointer is valid...

But later it fails in

--- Code: ---bool EncodingDetector::ConvertToWxString(const wxByte* buffer, size_t size)
--- End code ---
with

--- Code: ---if (!buffer || size == 0)
--- End code ---
so there is really something wrong here... More error logging would help. But in the end only debugging can solve this...

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version