MATLAB.jl icon indicating copy to clipboard operation
MATLAB.jl copied to clipboard

Matlab × symbol does not show correctly in Julia on Windows

Open musm opened this issue 9 years ago • 7 comments

Seems to be only an issue on windows. Look at ZData: [1�0 double] On linux this shows correctly 1×0

julia> using MATLAB
julia> x = linspace(0,1,10)
julia> eval_string("h=plot($x)")

h =

  Line with properties:

              Color: [0 0.4470 0.7410]
          LineStyle: '-'
          LineWidth: 0.8000
             Marker: 'none'
         MarkerSize: 6
    MarkerFaceColor: 'none'
              XData: [1 2 3 4 5 6 7 8 9 10]
              YData: [0 0.1111 0.2222 0.3333 0.4444 0.5556 0.6667 0.7778 0.8889 1]
              ZData: [1�0 double]

musm avatar Nov 19 '16 18:11 musm

Any clues why such behavior would be exhibited on windows only. Presumably mac is also correct.

musm avatar Nov 29 '16 17:11 musm

I would guess you are using a not-particularly-unicode-friendly font on windows. I have had to hack the registry to get DejaVu Sans Mono into the console.

twadleigh avatar Nov 29 '16 18:11 twadleigh

On the preview versions of Windows 10, DejaVu Sans Mono is an available command prompt font. Perhaps there are some more subtle font interaction problems?

musm avatar Nov 29 '16 18:11 musm

Checked it out myself. I see this, too.

twadleigh avatar Nov 30 '16 00:11 twadleigh

Somehow this is related to engEvalString and here http://stackoverflow.com/questions/15735072/get-matlab-engine-to-return-unicode I'm not sure if that really provides any solutions we can use

another case (but perhaps more expected)

julia> s = MATLAB.eval_string("s='Paul Erdős'")
julia> @mget s
"Paul Erdős"


musm avatar Mar 29 '17 18:03 musm

So it seems that we may have to enforce the locale on windows/osx feature('DefaultCharacterSet', 'UTF-8')

musm avatar Dec 19 '17 17:12 musm

Example

julia> using MATLAB

julia>  mat" feature('DefaultCharacterSet')"
"windows-1252"

julia> MATLAB.eval_string("s = 'Erdős'")
s =
    'Erdős'

julia> mat"s = 'Erdős'"

julia> get_variable(:s)
"Erdős"   # WRONG

# LET'S FORCE UTF8 in MATLAB
julia>  mat" feature('DefaultCharacterSet', 'UTF-8')"
"windows-1252"

julia> mat"s = 'Erdős'"


julia> MATLAB.eval_string("s = 'Erdős'")
s =
    'Erd→s'


julia> get_variable(:s)
"Erdős"  # Yay

musm avatar Dec 19 '17 17:12 musm