# HG changeset patch
# User Markus Mützel <markus.muetzel@gmx.de>
# Date 1486152947 -3600
#      Fri Feb 03 21:15:47 2017 +0100
# Node ID f40ee4c997a2cf5aec1f9871aaafee6989d12d13
# Parent  36983345732bd564fd60e6d1925a484682178af6
native2unicode.m, unicode2native.m: Fix tests on Windows (bug #49842).

diff -r 36983345732b -r f40ee4c997a2 scripts/strings/native2unicode.m
--- a/scripts/strings/native2unicode.m	Fri Feb 03 07:31:08 2017 -0800
+++ b/scripts/strings/native2unicode.m	Fri Feb 03 21:15:47 2017 +0100
@@ -23,10 +23,12 @@
 ##
 ## The numbers in the vector @var{native_bytes} are rounded and clipped to
 ## integers between 0 and 255.  This byte stream is then mapped into the
-## codepage given by the string @var{codepage} and returned in the string
+## code page given by the string @var{codepage} and returned in the string
 ## @var{utf8_str}.  Octave uses UTF-8 as its internal encoding.
-## The string @var{codepage} must be an identifier of a valid codepage.
-## Examples for valid codepages are "ISO 8859-1", "Latin-1" or "Shift-JIS".
+## The string @var{codepage} must be an identifier of a valid code page.
+## Examples for valid code pages are "ISO-8859-1", "Latin1", "Shift-JIS", or
+## "UTF-16".  For a list of code pages supported in Windows, see:
+## https://msdn.microsoft.com/en-us/library/windows/desktop/dd317756(v=vs.85).aspx
 ## If @var{codepage} is omitted or empty, the system default codepage is used.
 ##
 ## If @var{native_bytes} is a string vector, it is returned as is.
@@ -70,12 +72,12 @@
 endfunction
 
 ## "ЄЅІЇЈЉЊ"
-%!assert (double (native2unicode (164:170, 'ISO 8859-5')),
+%!assert (double (native2unicode (164:170, 'ISO-8859-5')),
 %!        [208 132 208 133 208 134 208 135 208 136 208 137 208 138]);
-%!assert (double (native2unicode ([164:166 0 167:170], 'ISO 8859-5')),
+## ["ЄЅІ" 0 "ЇЈЉЊ"]
+%!assert (double (native2unicode ([164:166 0 167:170], 'ISO-8859-5')),
 %!        [208 132 208 133 208 134 0 208 135 208 136 208 137 208 138]);
 
-## ["ЄЅІ" 0 "ЇЈЉЊ"]
 %!assert (native2unicode ("foobar"), "foobar");
 %!assert (double (native2unicode ([0 0 120.3 0 0 122.6 0 0])),
 %!        [0 0 120 0 0 123 0 0]);
@@ -85,4 +87,4 @@
 %!error <CODEPAGE must be a string> native2unicode (164:170, 123)
 %!error <converting from codepage 'foo' to UTF-8> native2unicode (234, 'foo')
 %!error <Invalid call> native2unicode ()
-%!error <Invalid call> native2unicode (1, 'Latin-1', 'test')
+%!error <Invalid call> native2unicode (1, 'Latin1', 'test')
diff -r 36983345732b -r f40ee4c997a2 scripts/strings/unicode2native.m
--- a/scripts/strings/unicode2native.m	Fri Feb 03 07:31:08 2017 -0800
+++ b/scripts/strings/unicode2native.m	Fri Feb 03 21:15:47 2017 +0100
@@ -22,9 +22,11 @@
 ## Convert UTF-8 string @var{utf8_str} to byte stream using @var{codepage}.
 ##
 ## The character vector @var{utf8_str} is converted to a byte stream
-## @var{native_bytes} using the codepage given by @var{codepage}.
-## The string @var{codepage} must be an identifier of a valid codepage.
-## Examples for valid codepages are "ISO 8859-1", "Latin-1" or "Shift-JIS".
+## @var{native_bytes} using the code page given by @var{codepage}.
+## The string @var{codepage} must be an identifier of a valid code page.
+## Examples for valid code pages are "ISO-8859-1", "Latin1", "Shift-JIS", or
+## "UTF-16".  For a list of code pages supported in Windows, see:
+## https://msdn.microsoft.com/en-us/library/windows/desktop/dd317756(v=vs.85).aspx
 ## If @var{codepage} is omitted or empty, the system default codepage is used.
 ##
 ## If any of the characters cannot be mapped into the codepage @var{codepage},
@@ -56,12 +58,12 @@
 
 endfunction
 
-%!assert (unicode2native ("ЄЅІЇЈЉЊ", "ISO 8859-5"), uint8 (164:170));
-%!assert (unicode2native (["ЄЅІ" 0 "ЇЈЉЊ"], "ISO 8859-5"), uint8 ([164:166 0 167:170]));
+%!assert (unicode2native ("ЄЅІЇЈЉЊ", "ISO-8859-5"), uint8 (164:170));
+%!assert (unicode2native (["ЄЅІ" 0 "ЇЈЉЊ"], "ISO-8859-5"), uint8 ([164:166 0 167:170]));
 
 %!error <UTF8_STR must be a character vector> unicode2native (['ab'; 'cd'])
 %!error <UTF8_STR must be a character vector> unicode2native ({1 2 3 4})
 %!error <CODEPAGE must be a string> unicode2native ('ЄЅІЇЈЉЊ', 123)
 %!error <converting from UTF-8 to codepage 'foo'> unicode2native ('a', 'foo')
 %!error <Invalid call> unicode2native ()
-%!error <Invalid call> unicode2native ('a', 'Latin-1', 'test')
+%!error <Invalid call> unicode2native ('a', 'Latin1', 'test')
