Please correct my programming

Theera

Expert
Licensed User
Longtime User
Hi Klaus and all,
Please correct my programming,I wonder that have something be wrong.
I think my answer was istr=Rice,Melon,Durain,Rose ,but it is istr=Melon,Durain,Rose

Best Regards
Theera
:sign0085:
 
Last edited:

klaus

Expert
Licensed User
Longtime User
The problem is not the code but your db.txt file.
You must save it with UTF-8 without BOM encoding.
In your file the is the BOM at the beginning that disturbs your code.
The attached db1.txt file is your db.txt file saved with notepad++ with UTF-8 without BOM encoding.

Best regards.
 

Attachments

  • db1.txt
    81 bytes · Views: 274
Upvote 0

Theera

Expert
Licensed User
Longtime User
Everytime I must encode with UTF-8 without BOM

The problem is not the code but your db.txt file.
You must save it with UTF-8 without BOM encoding.
In your file the is the BOM at the beginning that disturbs your code.
The attached db1.txt file is your db.txt file saved with notepad++ with UTF-8 without BOM encoding.

Best regards.

Hi Klaus,
Thank you very much. I need ask you about encoding. I ought to save as text file with UTF-8 without BOM encoding everytime or UTF-8 ? I always use Thai language. I 've never known about saving with UTF-8 without BOM encoding is difference from saving with UTF-8 encoding.

Best Regards
Theera
:confused:
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
In Windows when you save with UTF-8 encoding there is a bytes header added called Byte Order Mask (0xEF,0xBB,0xBF or ).
In Android these three bytes are considered as one character and disturbed your code. Android doesn't use the BOM.
With the text editor notepad++ you have the choice to save with different encodings.

Best regards.
 
Upvote 0
Top