Comments (7)
When a license is loaded from an encoded file the byte stream created by the decoding is converted to String using the platform default charset. Probably that is not utf-8 and that is the reason why you get the special characters.
As a side note: the method setLicenseEncodedFromFile
is deprecated and will be removed from newer releases, but this has nothing to do with the issue.
I will modify the behaviour to use utf-8 instead of the default charset in the next release, which is not scheduled yet.
from license3j.
So this means at the moment i cannot solve that problem by myself...
Using just UTF-8 probably also is not a good idea.
How about an overloaded License constructor (or the successor of setLicenseEncodedFromFile()) which uses per default the system charset and in a parameterized version the user can define it?
But at first it would be interesting if the problem with the German vowel also happens on your side.
from license3j.
If you look at the last commit diff you will see what causes the problem. I temporarily comitted into the source code change that makes the decoding to use utf-8.
The sample you provided and the analysis clearly leads to the conclusion that the default encoding on your machine is iso-latin-1. I see no point to reproduce the issue on my dev machine. And I also do not have the time.
from license3j.
I will consider your suggestion extending th API with overloaded methods.
from license3j.
That would be nice, thank you!
from license3j.
I'm experiencing exactly the same issue. (for the records: my system's encoding is UTF-8). The problem is obviously at this point in License
:
/**
* Set the license values from an input stream. The stream has to contain
* properties.
*
* @param is
* the input stream to read the properties values from
* @throws IOException
* when the input stream can not be read
*/
public void setLicense(final InputStream is) throws IOException {
verified = false;
licenseProperties = new Properties();
licenseProperties.load(is);
}
java.util.Properties.load(InputStream)
will always decode the InputStream using ISO 8859-1
as stated in the JavaDoc. I solved that problem through a quick and dirty fix by overriding the setLicense
method as follows and the umlauts decode just fine:
License license = new License() {
@Override
public void setLicense(InputStream is) throws IOException {
// super implementation sets verified = false, but the field
// cannot be accessed here, however, that doesn't seem to be an
// issue in my case, as the fields seems to get set correctly
// through setLicenseEncoded anyways; do not call super, because
// it will eat up the InputStream
licenseProperties = new Properties();
licenseProperties.load(new InputStreamReader(is, "utf-8"));
}
};
from license3j.
new version 1.0.8 will contain the new methods and the old methods are deprecated
from license3j.
Related Issues (20)
- License verification on Ubuntu vs Windows HOT 14
- License file is not closed after reading it HOT 1
- missing class HOT 1
- Exception when use a string with colon HOT 3
- Support for offline licensing HOT 7
- Improve performance by reducing / deferring Stream terminal operations HOT 1
- Sample and How to for new version HOT 1
- java.lang.ClassNotFoundException: javax0.license3j.io.LicenseReader
- A new version with org.bouncycastle:bcprov-jdk15on v1.60 HOT 5
- Question - Warning updating from 1.0.4 to 2.0.1 HOT 3
- License verification when adding a feature after signing. HOT 3
- how to migrate from 2 -> 3 HOT 2
- [ERROR] Key format STRING is unknown HOT 1
- Using network interface names to calculate machine UUID downsides HOT 3
- Wishlist: HOT 1
- Tests fail with JVM 13 and 17 HOT 1
- Exception while serializing Feature to JSON, e.g. DATE Feature not regocnized as DATE. HOT 3
- Trivial attack HOT 1
- [email protected] compatibility to [email protected] HOT 1
- java.security.InvalidKeyException: invalid key format HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from license3j.