Thread overview
[Issue 8643] New: [snn] _wfopen and other non-standard wide-character functions fail with non-ASCII symbols
Sep 11, 2012
Denis Shelomovskij
Sep 11, 2012
Denis Shelomovskij
Oct 17, 2013
Sönke Ludwig
Oct 18, 2013
Denis Shelomovskij
Oct 18, 2013
Denis Shelomovskij
Oct 19, 2013
Denis Shelomovskij
September 11, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8643

           Summary: [snn] _wfopen and other non-standard wide-character
                    functions fail with non-ASCII symbols
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: druntime
        AssignedTo: nobody@puremagic.com
        ReportedBy: verylonglogin.reg@gmail.com
            Blocks: 7648


--- Comment #0 from Denis Shelomovskij <verylonglogin.reg@gmail.com> 2012-09-12 00:15:52 MSD ---
---
import std.file: write;
import core.stdc.stdio: perror;

extern (C) nothrow int _wrename(in wchar* from, in wchar* to);

void main()
{
    // write("1.txt", "123");
    if(_wrename("1.txt"w.ptr, "2Ю.txt"w.ptr))
        perror("Error renaming file");
}
---

Output:
---
Error renaming file: Invalid argument
---
if:
* there is no 1.txt file
* there is 1.txt file
* there is no 1.txt file and `write` is uncommented

Output:
---
Error renaming file: File exists
---
if:
* there is 1.txt file and `write` is uncommented

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 11, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8643



--- Comment #1 from Denis Shelomovskij <verylonglogin.reg@gmail.com> 2012-09-12 00:27:31 MSD ---
These functions treats every UTF-16 codepoint as CP_ACP byte followed by zero byte (if second byte is non-zero, "Invalid argument" is returned). E.g. this will work:
---
import std.file: write;
import std.windows.charset: toMBSz;
import core.stdc.stdio: perror;
import std.exception: enforce;

extern (C) nothrow int _wrename(in wchar* from, in wchar* to);

void main()
{
    write("1.txt", "123");
    wchar[7] arr = "2#.txt\0"w;
    arr[1] = toMBSz("Ю")[0];
    enforce(_wrename("1.txt"w.ptr, arr.ptr) == 0);
}
---
(still don't understand "File exists" output of original example in
description)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 17, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8643



--- Comment #2 from github-bugzilla@puremagic.com 2012-09-16 20:45:19 PDT ---
Commit pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/d7a60b3b8a5a4d0ebc7743ae1a1502133521b571 Disable non-ASCII characters test because of snn.lib Issue 8643

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 17, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=8643


Sönke Ludwig <sludwig@outerproduct.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|major                       |critical


--- Comment #3 from Sönke Ludwig <sludwig@outerproduct.org> 2013-10-17 14:18:59 PDT ---
Increasing severity as this is really basic functionality.

This was also reported as a DUB bug: https://github.com/rejectedsoftware/dub/issues/130

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 18, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=8643


Denis Shelomovskij <verylonglogin.reg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|critical                    |major


--- Comment #4 from Denis Shelomovskij <verylonglogin.reg@gmail.com> 2013-10-18 09:59:12 MSD ---
(In reply to comment #3)
> Increasing severity as this is really basic functionality.

One can use `std.stream` which contains this functionality.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 18, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=8643


Denis Shelomovskij <verylonglogin.reg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|nobody@puremagic.com        |verylonglogin.reg@gmail.com


--- Comment #5 from Denis Shelomovskij <verylonglogin.reg@gmail.com> 2013-10-18 13:34:42 MSD ---
Assigned to myself. Reassign is somebody feels he can do it faster.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 19, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=8643


Denis Shelomovskij <verylonglogin.reg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|verylonglogin.reg@gmail.com |nobody@puremagic.com


--- Comment #6 from Denis Shelomovskij <verylonglogin.reg@gmail.com> 2013-10-19 14:02:11 MSD ---
(In reply to comment #5)
> Assigned to myself. Reassign is somebody feels he can do it faster.

Sorry, this is not the issue I'm solving. Reset assignee to default and opened Issue 11298 which will allow Issue 7648 to be resolved without fixing this one.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------