Can properties file have chinese characters without unicode characters?
In my project we need to support for chinese locale. We are using Resource.properties file which has all the strings used in the application as English characters. Instead of English characters, Can the Resource.properties files be set up to save and use the Chinese characters instead of encoded unicode values?
as i knew , it can't.
Similar Messages
-
How do I read a properties file in WEB-INF without hard-coding a path?
Hello,
How do I read a properties file in WEB-INF without hard-coding a path?
I tried:
Properties properties = new Properties();
properties.load(new FileInputStream("db.properties"));
driver = properties.getProperty("driver");
but it cannot find the db.properties file.
Thanks for the help.
FrankDon't use a File to read those properties.
Better to use the servlet context and
getResourceAsStream() method to get the InputStream.
It'll look for any file in the CLASSPATH. If you put
that properties file in the WEB-INF/classes directory
you'll have no problems, even if you deploy with a
WAR file.Completely agree with this approach. Just have to mention the following for completeness
according to the API,
"This method is different from java.lang.Class.getResourceAsStream, which uses a class loader. This method allows servlet containers to make a resource available to a servlet from any location, without using a class loader. "
So using this method, the resource can be anywhere under your web context, not just in the classpath.
Cheers,
evnafets -
If i download any file which is prepare on microsoft office 2007 . The file have been download without extension of the prog. Means if files name is "1,docx" when i download from firefox it download in that form "1". after download i have to rename and give the extension name is plz tell me the way that office files are compatible with it.
== This happened ==
Every time Firefox opened
== when i download the office filesIn Firefox Options / Privacy be sure "Remember download history" is checked. To see all of the options on that panel, "Firefox will" must be set to "Use custom settings for history".
To find your OS information, on your Windows desktop, right-click the My Computer icon, choose Properties, under System on that small window is info about your OS.
'''If this reply solves your problem, please click "Solved It" next to this reply when <u>signed-in</u> to the forum.''' -
Can a file be uploaded automatically without
browsing to it. i have an app that was searching for an id and getting data back on the next page then creating a text file and writing to it. can i have that file uploaded after it has been written to it without a user browsing to where it is? need a little direction please?
thanxhow to receive the uploaded file with servlet's request ?
-
Can I create a Coding Mask without special characters?
Good morning,
Our client wants a project code with the following masks:
XX0000-0000.
Please advise how to proceed with it.
Best regards,
NatHi Nat,
u cant have both numeric and alphanumeric in single word "XX0000". U can make the same as "XXXXXX"
and there should be a specific project ID and Project ID and coding mask should be separated by a special character.
u can make the coding mask as explained below
Project ID CODING MASK
1) A :XX-0000-0000
2) A :XXXXXX-0000
REGARDS
Avinash -
Mac book Pro running 10.8 mountain lion.
My preferred editor is vim (it comes with 10.8).
When I re-edit a plain ascii file, every line ends with (ctrl-v) (ctrl-m).
They appear after saving the file to hard drive.
It started doing this just after moving from 10.7 to 10.8.
question 1: Is there some way to turn off this feature?
question 2: I wonder what I did to accidently turn on this feature?Hi,
>>A CHAR datatype and VARCHAR2 datatype are stored identically (eg: the word 'WORD' stored in a CHAR(4) and a varchar2(4) consume exactly the same amount of space on disk, both have leading byte counts).
Ok, but on the other hands:
SGMS@ORACLE10> create table x (name char(10), name2 varchar2(10));
Table created.
SGMS@ORACLE10> insert into x values ('hello','hello');
1 row created.
SGMS@ORACLE10> commit;
Commit complete.
SGMS@ORACLE10> select vsize(name),vsize(name2) from x;
VSIZE(NAME) VSIZE(NAME2)
10 5
SGMS@ORACLE10> select dump(name),dump(name2) from x;
DUMP(NAME) DUMP(NAME2)
Typ=96 Len=10: 104,101,108,108,111,32,32,32,32,32 Typ=1 Len=5: 104,101,108,108,111Cheers -
Hi guys.
I use QT SDK to write a sample to load movie files.
when install QuickTime7.7.1 and call QT SDK's interface(OpenMovieFile method) to open file, it doesn't work. i will get error(-36). but when i use QT 7.6.9, it works well.
so how can i use QT SDK(install QT7.7.1 and OS is windows xp) to open movie file which fullpath include wide unicode characters(like D:\Media動画).
much appreciate.For Bex Query Application string 7.x Version Error
-
Non-Latin-1 characters in properties files?
We are having substantial difficulties translating a properties file into Turkish (which uses 6 characters outside the Latin 1 code page). The only way we've found to encode them that seems to work is to encode them with backslash escapes. Is there a better way?
No, what you did is what you have to do. From the API documentation for Properties:
"When saving properties to a stream or loading them from a stream, the ISO 8859-1 character encoding is used. For characters that cannot be directly represented in this encoding, Unicode escapes are used; however, only a single 'u' character is allowed in an escape sequence. The native2ascii tool can be used to convert property files to and from other character encodings." -
CRVS2010 Beta - Cannot export report to PDF with unicode characters
My report has some unicode data (Chinese), it can be previewed properly in the windows form report viewer. However, if I export the report document to PDF file, the unicode characters in exported file are all displayed as a square.
In the version of Crystal Report 2008 R2, it can export the Chinese characters to PDF when I select a Chinese font in report. But VS2010 beta cannot export the Chinese characters even a Chinese font is selected.Barry, what is the specific font you are using?
The below is a reformatted response from Program Management:
Using non-Chinese font with Unicode characters (Chinese) the issue is reproducible when using Arial font in Unicode characters field. After changing the Unicode character to Simsun (A Chinese font named 宋体 in report), the problem is solved in Cortez and CR both.
Ludek -
Setting up .properties file
Hello
I would like to know if theres any particular rules for setting up the .properties file. Like in my application i have four *.properties files
1)log4j.properties 2) mapping.properties and so on
the mapping.properties file have jsps mapping..so basically it says
(key) add.project.param = (value)add_project.jsp
project = project.jsp
I am trying to understand how response.sendRedirect sends the appropriate link to project.jsp (view page) from add_project.jsp
In add_project.jsp, response.sendRedirect is simply written as
response.sendRedirect("tsaa.go?param=view&oid=" + parent + "&type=" + ptype);in my servlet dispatcher class; there are various functions two of them are
1) void processRequest(HttpServletRequest request, HttpServletResponse response) { }
2) String getForwardPage(HttpServletRequest request, HttpServletResponse response) { }
and i think these classes take care of forwarding the request to appropriate page.
If there are certain rules for setting up the mapping.properties file, do i have to set my new jsp pages in mapping.properties file as:
quality.control.param = quality_control.jsp
quality.control.results = quality_control_results.jsp
(rite now i am using qc.results = quality_control_results.jsp and that doesnt seem to work)
somehow response.sendRedirect("tsaa.go?param=view&oid=" + parent + "&type=" + ptype) doesn't seem to work in my quality_control.jsp page. Without the above line i can atleast move till quality_control.jsp page from home.jsp....but with response.sendRedirect().....i am on home.jsp after a refresh.
if u know any links where i can read abt .properties file please let me know. googling gave me build.properties file but nothing for jsp mappings
Any help is appreciated
Thanxi got the solution
please ignore the posting
thanx -
PLEASE HELP. How do you access properties files in WEB-INF and classes directory
We have a war file that needs to access properties files that are in the WEB-INF directory
of the war file. We also need to load one of the properties files from the classpath.
However, when we deploy the application ( an ear which inlcludes an ejbjar and a
war and the libraries both the ejbjar (with a manifest setting the classpath ) and
war need ) the properties don't get extracted.
In some of our servlets we are trying to access those files with the path "WEB-INF/foo.properties"
and we get a FileNotFoundException. Then we check and see that NO properties files
have been extracted into their appropriate places ( not even those we throw into
the WEB-INF/classes directory ).
PLEASE HELP,
Christian HargravesThe file doesn't have to be extracted from the war. For example, you can place
test.properties into your app WEB-INF and write a simple JSP to see how it
works:
<%
InputStream in = application.getResourceAsStream("/WEB-INF/test.properties");
%>
It will return you a zip inputstream if you deployed your application as a .war.
Christian Hargraves <[email protected]> wrote:
I try this, but I get a NullPointerException. The file never actually gets extracted
from the war. Under tomcat and resin this works great ( that's why I am having all
of the trouble i am having ), but there are absolutely no properties files in the
extracted directories for WebLogic deploys. only:
WEB-INF/some_tmp_dir/WEB-INF/lib
and then some dynamically generated jor file with all of the classes that would normally
go in WEB-INF/classes ( all except the properties, of course, which are no where
to be found. ).
There has to be some kind of setting I am missing. Please don't make me seperate
these properties files from the war/ear and then put the path to these properties
files in the CLASSPATH, changing one step to three steps to deploy!!
I have found a documented bug where you can't even put the properties files in a
jar file and that bug will never be fixed for WebLogic 6.1.
"Dimitri I. Rakitine" <[email protected]> wrote:
To access files in WEB-INF you can use ServletContext.getResourceXXX("/WEB-INF/filename")
Christian Hargraves <[email protected]> wrote:
We have a war file that needs to access properties files that are in theWEB-INF directory
of the war file. We also need to load one of the properties files fromthe classpath.
However, when we deploy the application ( an ear which inlcludes an ejbjarand a
war and the libraries both the ejbjar (with a manifest setting the classpath) and
war need ) the properties don't get extracted.
In some of our servlets we are trying to access those files with the path"WEB-INF/foo.properties"
and we get a FileNotFoundException. Then we check and see that NO propertiesfiles
have been extracted into their appropriate places ( not even those wethrow into
the WEB-INF/classes directory ).
PLEASE HELP,
Christian Hargraves--
Dimitri
Dimitri -
Replacing Unicode characters in a String
I have a text as a String and in this text which is foreign language appears sometimes characters in Unicode format as &#246; or &#214;
The question is, how can I convert this String so these Unicode characters would become readable characters.
Thank you for any lead...:-) Interesting - twice in 10 minutes I'm recommending the use of Elliott Hughes' class. See http://elliotth.blogspot.com/2004/07/java-implementation-of-rubys-gsub.html .
You just have to write a regular expression to match the terms ( "&#(\\\d+)"), extract the number as a string (group(1)) then use the Integer.parseInt(the numeric string) and cast to a char.
Edited by: sabre150 on Feb 9, 2012 9:53 AM
This is an example I wrote a couple of years ago (and published on the old Sun site forums) that does pretty much exactly what you need
import e.util.Rewriter;
public class Sabre20090919
public static void main(String[] args) throws Exception
String title = "& #26412;& #26399;& #28136;& #21033;\n" +
"& #22522;& #26412;& #27599;& #32929;& #30408;& #39192;\n" +
"& #32380;& #32396;& #29151;& #26989;& #21934;& #20301;& #28136;& #21033;\n" +
"& #26371;& #35336;& #21407;& #21063;& #35722;& #21205;& #32047;& #31309;& #24433;& #38911;& #25976;\n" +
"& #26222;& #36890;& #32929;& #27599;& #32929;& #30408;& #39192;\n" +
"& #31232;& #37323;& #27599;& #32929;& #30408;& #39192;\n";
Rewriter rewriter = new Rewriter("&\\s*#(\\d+);")
@Override
public String replacement()
return Character.toString((char) Integer.parseInt(group(1)));
title = rewriter.rewrite(title);
System.out.println(title);
System.out.print("Unicode :\"");
for (char ch : title.toCharArray())
System.out.printf("\\u%04x", (int) ch);
System.out.println("\"");
byte[] asBytes = title.getBytes("big5");
for (byte b : asBytes)
System.out.printf("%02x ", (int) (b & 0xff));
System.out.println();
}The rest is just a test harness.
Edited by: sabre150 on Feb 9, 2012 10:02 AM
Removed redundant code -
ServletContext Vs Properties file
Dear Friends,
My question is related to optimization.
In our Servlet application, We have to read some values
from properties files. In this which one is better from the following
or is there any better way of doing?
1. Reading from the Properties file everytime required. (So for each user the Properties file have to be accessed)
or
2. Reading from the Properties file once in the init method of the servlet and store those in the Servlet Context variables and use it whenever required.
Please suggest me the best way.
Thanks in advance.
Regards,
GoudhamI think the best way would be to read the property
file one time and store it as a hashtable and the last
modified date, stored as a Long, should be stored up
in a Hashtable, keyed on the filename. The Properties
should be loaded from the file only if the last
modified time in the Hashtable is less than the last
modified time of the file, or if the filename isn't
found. This insures that a modification check is done
for each Properties file individually, and that they
are all continually up to date. Also on server
restart, all files are reloaded since they aren't
initially listed in the Hashtable.
Just a opinion
-AsheeshThanks!
If I understand correctly, Read the Properties file once and store the Key Value pairs in a Hashtable then maintain this Hashtable in ServletContext? Is this correct?
- Goudham -
Unicode Characters in J2ME.....Urgent
Hello...
I want to developed a simple text message service application. It's a simple SMS application but i want to translate character into other language. For example when the button M is selected on the keypad, the alternative Ethiopian alphabet will show up. Can anybody knows how to use Java Unicode characters. I want to Map english characters to Ethopian alphabate.
Thanks in AdvanceHi
Read this post: http://www.j2meforums.com/yabbse/index.php?board=2;action=display;threadid=9553;start=msg43827#msg43827
Mihai -
How big is too big for .properties file for a ResourceBundle?
The subject says it all. We are using ResourceBundles to manage the dictionary of English/French literals for our web enabling project. Our .properties file is currently 675 key/value pairs. How big can .properties files grow before they are too big?
Thanks,
Don Booker - Programming Team Leader
Common Departmental Financial System
Public Works & Government Services CanadaThe resource gets loaded into memory, so there's a memory cost that increases with the number of properties. (There's also a time cost when it loads, but that's only once.) And finding one of the properties requires a search, so there's a processing cost involved. But it's based on a Hashtable, so it isn't a major cost even if the number of properties gets very large.
So there's your constraints. The question is, though, what is your alternative when the resource does get too big? A database? That reduces the memory cost but increases the processing cost. I would guess you could let your properties file grow a lot before you were forced to go to a database, but actual testing would help.
Maybe you are looking for
-
After a computer restart, Firefox always defaults in Options, Tabs, 'Open new windows on a new Tab' unchecked. After checking the box Firefox will then open new windows in a tab instead of a new window, However after a shutdown of the computer the ch
-
Hello, We have been having this issue for quite some time and I have endlessly searched the internet for answers as well as this forum but it doesn't seem like anyone has been able to help. We are using Outlook 2010 and I have two employees who need
-
HTTP proxy for AS2 delivery channel
Hi All, During AS2 delivery channel configuration, there is a check box "Use proxy". Where do I specify the proxy details? Also, for additional http headers, what is the standard that needs to be followed? Regards, Praveen
-
How to avoid waiting forever when Updating a locked row ?
Hi all, We have front-end application (ADF BC) on Oracle 10g database. From the adf we call stored procedure that execute the dml below : UPDATE DOC_NUMBER SET doc_nbr = doc_nbr + 1 WHERE REGISTER = pRegsCode AND doc_code = pDocCode AND loc_code = pL
-
I have the following lines in my program : if (new File(Item_Image_Path).exists()) BufferedImage Buffered_Image=ImageIO.read(new File(Item_Image_Path)); // "C:/01_Pictures/GX910120.JPG" Image_Width=Buffered_Image.getWidth(); I got an error message, b