# HG changeset patch # User jwe # Date 1191515558 0 # Node ID 9dabcb305dda09fa47696e9233b165688623019d # Parent 4567a35e077775e6b0db099e5f71d071960b5e5e [project @ 2007-10-04 16:32:37 by jwe] diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,17 @@ +2007-10-04 Jason Riedy + + * ls-mat5.cc (read_mat5_binary_data): Map miUTF16 to miUINT16, + miUTF32 to miUINT32. The matfile format currently states that + wide UTF formats are in the same byte order as the integers. + (read_mat5_binary_element): Replace all UTF16 and UTF32 + characters with the high bit set (value >127) by '?' and warn + that we've done so. + +2007-10-04 Michael Goffioul + + * sysdep.cc (w32_set_octave_home): Base OCTAVE_HOME location on + octinterp, not the main exe. + 2007-10-03 John W. Eaton * data.cc (Fnorm): New function. diff --git a/src/ls-mat5.cc b/src/ls-mat5.cc --- a/src/ls-mat5.cc +++ b/src/ls-mat5.cc @@ -140,6 +140,7 @@ read_doubles (is, data, LS_SHORT, count, swap, flt_fmt); break; + case miUTF16: case miUINT16: read_doubles (is, data, LS_U_SHORT, count, swap, flt_fmt); break; @@ -148,6 +149,7 @@ read_doubles (is, data, LS_INT, count, swap, flt_fmt); break; + case miUTF32: case miUINT32: read_doubles (is, data, LS_U_INT, count, swap, flt_fmt); break; @@ -1251,8 +1253,20 @@ { if (type == miUTF16 || type == miUTF32) { - error ("load: can not read Unicode UTF16 and UTF32 encoded characters"); - goto data_read_error; + bool found_big_char = false; + for (int i = 0; i < n; i++) + { + if (re(i) > 127) { + re(i) = '?'; + found_big_char = true; + } + } + + if (found_big_char) + { + warning ("load: can not read non-ASCII portions of UTF characters."); + warning (" Replacing unreadable characters with '?'."); + } } else if (type == miUTF8) { diff --git a/src/sysdep.cc b/src/sysdep.cc --- a/src/sysdep.cc +++ b/src/sysdep.cc @@ -119,7 +119,8 @@ while (true) { - int status = GetModuleFileName (0, &bin_dir[0], n); + HMODULE hMod = GetModuleHandle ("octinterp"); + int status = GetModuleFileName (hMod, &bin_dir[0], n); if (status < n) {