Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Widgets - General questions or Mixed problems » Error: Invalid UTF-8 sequence when reading txt file from hard disk
Error: Invalid UTF-8 sequence when reading txt file from hard disk [message #16656] Sat, 05 July 2008 20:57 Go to next message
alex100 is currently offline  alex100
Messages: 118
Registered: November 2007
Experienced Member
Hi,
I am having troubles reading a text file from disk.
I created the txt file with windows XP (PT) notpad. Then, in a Upp I use the fopen and fgets to read file lines.
When I add the lines read to a ArrayCtrl I cant see the accents. If I try to display it using the Exclamation message box function it displays "ERROR: Invalid UTF-8 sequence".

Any doc to read about how U++ handles different char sets?

Any help would be appreciated.

Thank you,

Alex
Env:Win XP (PT), U++ 2007.1
Re: Error: Invalid UTF-8 sequence when reading txt file from hard disk [message #16659 is a reply to message #16656] Sun, 06 July 2008 09:10 Go to previous messageGo to next message
Mindtraveller is currently offline  Mindtraveller
Messages: 917
Registered: August 2007
Location: Russia, Moscow rgn.
Experienced Contributor

1. Are you shure it is really a UTF-8 text? If not, better test it in some UTF-8 capable viewer.
2. Did you switch application charset to UTF-8 by calling SetDefaultCharset(CHARSET_UTF8); ? U++ should know the text labels you use are in UTF-8.
3. It would be easier to help when we see your code where you load and show these strings.

[Updated on: Sun, 06 July 2008 09:10]

Report message to a moderator

Re: Error: Invalid UTF-8 sequence when reading txt file from hard disk [message #16663 is a reply to message #16659] Sun, 06 July 2008 11:02 Go to previous messageGo to next message
alex100 is currently offline  alex100
Messages: 118
Registered: November 2007
Experienced Member
But, does u++ just deals with UTF-8? Is UTF-8 the default charset when noting is configured ?

Alex
Re: Error: Invalid UTF-8 sequence when reading txt file from hard disk [message #16668 is a reply to message #16663] Sun, 06 July 2008 23:18 Go to previous messageGo to next message
Mindtraveller is currently offline  Mindtraveller
Messages: 917
Registered: August 2007
Location: Russia, Moscow rgn.
Experienced Contributor

alex100 wrote on Sun, 06 July 2008 13:02

But, does u++ just deals with UTF-8? Is UTF-8 the default charset when noting is configured ?

1) It does Smile
2) Sorry, I don`t remember exactly. May be not, default could be EN-US, or something like that. Besides, calling 1 operator at program start doesn`t look like a great deal of configuring. Does it?
Re: Error: Invalid UTF-8 sequence when reading txt file from hard disk [message #16671 is a reply to message #16656] Mon, 07 July 2008 10:13 Go to previous messageGo to next message
mr_ped is currently offline  mr_ped
Messages: 825
Registered: November 2005
Location: Czech Republic - Praha
Experienced Contributor
I think UPP default is not UTF-8 in Windows, and I'm not sure about Ubuntu.
I wouldn't care about default setting anyway, just set it up by hard way and forget about it.
Re: Error: Invalid UTF-8 sequence when reading txt file from hard disk [message #16674 is a reply to message #16656] Mon, 07 July 2008 11:38 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
alex100 wrote on Sat, 05 July 2008 14:57


If I try to display it using the Exclamation message box function it displays "ERROR: Invalid UTF-8 sequence".



The problem most likely is that UTF-8 is default encoding of QTF texts. If you submit a text without explicit encoding enforced via QTF commands, parser expects UTF-8.

Note that QTF encoding is different (has to be!) from default application encoding.

Mirek
Previous Topic: How To Find/Replace on RichEditWithToolBar
Next Topic: Can we get OptionTree:ManualMode?
Goto Forum:
  


Current Time: Fri Apr 19 00:23:34 CEST 2024

Total time taken to generate the page: 0.04347 seconds