digitalmars.D - utf-8?
- Steve Teale <steve.teale britseyeview.com> Mar 17 2009
- Ary Borenszweig <ary esperanto.org.ar> Mar 17 2009
- Trass3r <mrmocool gmx.de> Mar 17 2009
- Steve Teale <steve.teale britseyeview.com> Mar 17 2009
- Ary Borenszweig <ary esperanto.org.ar> Mar 17 2009
- Walter Bright <newshound1 digitalmars.com> Mar 17 2009
- Georg Wrede <georg.wrede iki.fi> Mar 17 2009
- Gide Nwawudu <gide btinternet.com> Mar 17 2009
- Steve Teale <steve.teale britseyeview.com> Mar 18 2009
- Daniel Keep <daniel.keep.lists gmail.com> Mar 18 2009
- "Denis Koroskin" <2korden gmail.com> Mar 17 2009
import std.stdio;
void main()
{
string s = "Die Walküre";
writefln(s);
}
Gives error - invalid utf-8 sequence. I pasted the text from a Wiki page that
claims to be utf-8. What's happening?
Mar 17 2009
Steve Teale wrote:import std.stdio; void main() { string s = "Die Walküre"; writefln(s); } Gives error - invalid utf-8 sequence. I pasted the text from a Wiki page that claims to be utf-8. What's happening?
Did you save the file as UTF-8?
Mar 17 2009
Ary Borenszweig schrieb:Gives error - invalid utf-8 sequence. I pasted the text from a Wiki page that claims to be utf-8. What's happening?
Did you save the file as UTF-8?
Yeah, you must save the file as UTF-8.
Mar 17 2009
Ary Borenszweig Wrote:Steve Teale wrote:import std.stdio; void main() { string s = "Die Walküre"; writefln(s); } Gives error - invalid utf-8 sequence. I pasted the text from a Wiki page that claims to be utf-8. What's happening?
Did you save the file as UTF-8?
Was not offered the opportunity. I pasted the text from the web page into Windows Notepad, and saved it - this seemed to me to be as generic as possible given the facilities I have available. What editor will do the trick? Also, if I'm using the Windows version of the compiler, shouldn't it be smart enough to convert the Windows character set to UTF-8?
Mar 17 2009
Steve Teale wrote:Ary Borenszweig Wrote:Steve Teale wrote:import std.stdio; void main() { string s = "Die Walküre"; writefln(s); } Gives error - invalid utf-8 sequence. I pasted the text from a Wiki page that claims to be utf-8. What's happening?
Was not offered the opportunity. I pasted the text from the web page into Windows Notepad, and saved it - this seemed to me to be as generic as possible given the facilities I have available. What editor will do the trick? Also, if I'm using the Windows version of the compiler, shouldn't it be smart enough to convert the Windows character set to UTF-8?
Notepad will do the trick, but you must save it as UTF-8. In the Save As dialog select UTF-8 in Encoding.
Mar 17 2009
Steve Teale wrote:Also, if I'm using the Windows version of the compiler, shouldn't it be smart enough to convert the Windows character set to UTF-8?
The huge problem with code pages is, given a file with some text in it, there is NO CLUE what code page the file's text encoding is in. Just because dmd is running on Windows is not any reason at all that the character set of the file must be the Windows character set. I ran into this problem all the time with C code.
Mar 17 2009
Steve Teale wrote:import std.stdio; void main() { string s = "Die Walküre"; writefln(s); } Gives error - invalid utf-8 sequence. I pasted the text from a Wiki page that claims to be utf-8. What's happening?
I pasted your code above and compiled and ran it with no problem. I'm on linux: Fedora 10, and dmd v2.026.
Mar 17 2009
On Tue, 17 Mar 2009 10:48:56 -0400, Steve Teale <steve.teale britseyeview.com> wrote:import std.stdio; void main() { string s = "Die Walküre"; writefln(s); } Gives error - invalid utf-8 sequence. I pasted the text from a Wiki page that claims to be utf-8. What's happening?
Works for me, you should save the file as UTF-8 and set your codepage to 65001. C:\> dmd test.d C:\> test Die Walk+?re C:\>chcp 65001 Active code page: 65001 C:\>test Die Walküre Gide
Mar 17 2009
Gide Nwawudu Wrote:On Tue, 17 Mar 2009 10:48:56 -0400, Steve Teale <steve.teale britseyeview.com> wrote:import std.stdio; void main() { string s = "Die Walküre"; writefln(s); } Gives error - invalid utf-8 sequence. I pasted the text from a Wiki page that claims to be utf-8. What's happening?
Works for me, you should save the file as UTF-8 and set your codepage to 65001. C:\> dmd test.d C:\> test Die Walk+?re C:\>chcp 65001 Active code page: 65001 C:\>test Die Walküre Gide
Yup, that does it. I'd missed the encoding option in notepad. What were you running the program in - in a cmd window I see graphics characters.
Mar 18 2009
Steve Teale wrote:Gide Nwawudu Wrote:On Tue, 17 Mar 2009 10:48:56 -0400, Steve Teale <steve.teale britseyeview.com> wrote:import std.stdio; void main() { string s = "Die Walk�re"; writefln(s); } Gives error - invalid utf-8 sequence. I pasted the text from a Wiki page that claims to be utf-8. What's happening?
to 65001. C:\> dmd test.d C:\> test Die Walk+?re C:\>chcp 65001 Active code page: 65001 C:\>test Die Walk�re Gide
Yup, that does it. I'd missed the encoding option in notepad. What were you running the program in - in a cmd window I see graphics characters.
You have to configure CMD to use Lucida Console as the font. Also note that CMD won't do fallbacks like virtually every other Windows app: if a character isn't in Lucida Console, you won't see it. -- Daniel
Mar 18 2009
On Wed, 18 Mar 2009 02:34:49 +0300, Gide Nwawudu <gide btinternet.com> wrote:On Tue, 17 Mar 2009 10:48:56 -0400, Steve Teale <steve.teale britseyeview.com> wrote:import std.stdio; void main() { string s = "Die Walküre"; writefln(s); } Gives error - invalid utf-8 sequence. I pasted the text from a Wiki page that claims to be utf-8. What's happening?
Works for me, you should save the file as UTF-8 and set your codepage to 65001. C:\> dmd test.d C:\> test Die Walk+?re C:\>chcp 65001 Active code page: 65001 C:\>test Die Walküre Gide
I believe Phobos should do it manually.
Mar 17 2009









Trass3r <mrmocool gmx.de> 