• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 355
  • Last Modified:

JVM encoding. How to change encoding.

To make story short, I simplify my case as much as possible.
Please take a look on this share pic
https://gyazo.com/cfea9042b2b2d9f7f8959de7c2913055

Please tell me what I'm doing wrong. I use encoding codes from this table
http://scratchpad.wikia.com/wiki/Character_Encoding_Recommendation_for_Languages
For example I need Albanian.

The restriction is that no source code changes allow.
0
SunnyX
Asked:
SunnyX
  • 12
  • 10
  • 4
  • +1
2 Solutions
 
CEHJCommented:
Please take a look on this share pic
Couple of things there

a. there's no need to link to external sites - it's quite possible to post images directly on this one
b. in most cases you want to copy from cmd.exe and paste here (see below)

Please post the output of the following

java Props file.encoding

Open in new window


See ( http://technojeeves.com/index.php/aliasjava1/16-javasystemproperties )

Oh and it might help to post the code of that HelloWorld too
0
 
SunnyXAuthor Commented:
If shortly, in command line :

I change chcp on 1250
makes: javac myClass.java
makes: java myClass

and still haven't good letters
in my output
0
 
SunnyXAuthor Commented:
C:\Users\***\*** Drive\*** development\*** all\***\dev\projects\***\*\src\main\java>chcp
Active code page: 437

C:\Users\*****\*** Drive\*** development\*** all\***\dev\***\***\*\src\main\java>chcp
 1250
Active code page: 1250

C:\Users\***\**** Drive\Software development\*** all\***\dev\projects\***\***\src\main\java>chcp
Active code page: 1250

C:\Users\***\Google Drive\Software development\myGJJ
all\GJJRepoAlgoLevelTwo\dev\projects\getjavajob\algo\src\main\java>java com.***.***.***.***.***
.HelloWorldAlbanian
P???rsh???ndetje bot???!

C:\Users\***\*** Drive\*** development\*** all\***\dev\projects\***\***\src\main\java>
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
CEHJCommented:
That's not an answer to the question i asked. In fact it really repeats information you have already given
0
 
SunnyXAuthor Commented:
Error: Could not find or load main class Props

Open in new window

0
 
SunnyXAuthor Commented:
....\dev\projects\***\algo\src\main\java\com\***\***\***\***\***>java Props file.encoding
Error: Could not find or load main class Props

Open in new window

0
 
CEHJCommented:
Did you download and compile the Java source at the link?
0
 
CEHJCommented:
Actually, this is too painful - we can leave the question of what encoding you are using as a mystery for future solution

Open a new cmd.exe window and run your code like this:
java -Dfile.encoding=windows-1252 WhateverYourClassIs

Open in new window

0
 
SunnyXAuthor Commented:
The same garbage output...

P�rsh�ndetje bot�!
0
 
SunnyXAuthor Commented:
-Dfile.encoding ... seems make no difference at all

when I change chcp on 65001
the output is:
P�rsh�ndetje bot�!

However, when I do Dfile.encoding=windows-65001 the output is P�rsh�ndetje bot�! ( like the first one )
I even, by mistake, write down Dfile.encoding=windows-65002 and cmd throw the same garbage P�rsh�ndetje bot�!
However, by logic it should throw exception instead...
but  the cmd didn't tell me that there is any mistake ( like "Invalid code page"  like chcp doing )
btw, I use Windows 10
0
 
SunnyXAuthor Commented:
and yes I switch on lucida console
0
 
CEHJCommented:
Actually i now DO need the output i asked for HERE so please compile and run Props.java in the way i showed
0
 
CEHJCommented:
And you didn't post the source for HelloWorldAlbanian as i requested
0
 
krakatoaCommented:
So have you tried code pages

1252

and also ISO

8859-1
8859-2
8859-9
8859-15.
0
 
SunnyXAuthor Commented:
And you didn't post the source for HelloWorldAlbanian as i requested

Open in new window


Sorry,
Here the source code.
package com.g*********.***.al***.***.l***;

/**

 */
public class HelloWorldAlbanian {
    public static void main(String[] args) {
        System.out.println("P�rsh�ndetje bot�!");
    }
}

Open in new window


Actually i now DO need the output i asked for HERE so please compile and run Props.java in the way i showed

I'm so sorry. I really wanna give you output from the
java Props file.encoding

Open in new window

But once again it gives me nothing when I try to compile the code as I post before HERE    Are you sure that this is valid command ? in which folder should I run it ??? May be I made mistake by running the command in wrong folder. Because you know there is a difference between running java and javac require different folders for example ( because of the packages ) like it mention in https://javarevisited.blogspot.com/2015/04/error-could-not-find-or-load-main-class-helloworld-java.html
0
 
CEHJCommented:
Here the source code.
OK, but that's not helpful - as you can see - this site has not reproduced it properly.
Please do two things:

a. attach it as a file
b. post a screenshot of the source
0
 
SunnyXAuthor Commented:
0
 
SunnyXAuthor Commented:
btw, I generate .class file by using this command in cmd

javac -encoding Windows-1252 MyClass.java

Open in new window


and beforehand I change chcp on 1252 too
0
 
CEHJCommented:
But ... that is already messed up. All it shows are question marks. How is that Albanian?
0
 
SunnyXAuthor Commented:
Okey I'm done. Now everything fine. The solution was I need to reload file after I change encoding in ide.
https://gyazo.com/8b6da5f005c2a1ed7fd5c04046568956
after than I generate new .class file with chcp 1252 and everything good now ! thx for your time

https://gyazo.com/bbd0c35832f91a46537eed7ad77e51b9
0
 
SunnyXAuthor Commented:
Thx a lot !
0
 
CEHJCommented:
OK. btw afaics there's absolutely nothing special about Albanian. The standard code pages /encodings should do it fine
0
 
krakatoaCommented:
1252 eh? Rings a bell.
0
 
gurpsbassiCommented:
Sunnyx are you friends with guddi9?
0
 
krakatoaCommented:
@gurpsbassi

Are you suggesting a Romano-Latin axis ?

I also think , CEHJ, that Albanian does have special alphabetic elements not present in other languages.
0
 
CEHJCommented:
I also think , CEHJ, that Albanian does have special alphabetic elements not present in other languages.
Not sure what you have in mind but the OP's own link at http://scratchpad.wikia.com/wiki/Character_Encoding_Recommendation_for_Languages shows that windows-1252 (default in the UK) can cope with Albanian, so i don't see how they could be particularly exotic ;)
0
 
krakatoaCommented:
The webpage SunnyX uses then must be wrong, would you say? Albanian does not figure in the 1252 table that I came upon elsewhere.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 12
  • 10
  • 4
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now