Reading an Arabic Punctuation character
Hi.
I am writing a program that reads a list of words from a text file. The words are either english or Arabis. Moreover, some words are punctuation marks like ? or :. The problem I have is with reading Arabic punctuation marks like the Arabic comma � or the Arabic question mark � it seems that when java reads them but internally "translates" to something else. My goal is to delete these symbols from my files, but I cannot get a hold of them because the .equals and .compareTo methods do not seem to identify them.
Any tips on this issue would be greatly appreciated.
Are these characters represented as literals in your source code? If so, it could be the literals in your class files that are corrupted, no the text you're reading in at runtime. If that's the case, you either need to make sure your editor and the compiler are using the correct encoding, or replace the literal characters the source code with Unicode escapes, like "\u060C" or '\u061F'.
Similar Messages
-
Reading a non-english character
Hi, I have a trouble with reading a non-english character from a html page.
I'm taking the word from the html page, and compare it with itself,
like this
string.equals("BİTTİ")
but it returns false.
is it possible to correct this?specify an encoding for your inputstream reader:
BufferedReader in = new BufferedReader(
new InputStreamReader(new FileInputStream("infilename"), "8859_1")); for example -
Trying to read from a socket character by character
Hi all,
I have a problem with reading from a socket character by character. In the code shown below I try and read each character, and then write it to a file. The information sent to a socket sent from a file, and EOF is marked with character of ascii code 28 (file separator). However using BufferedReader.read() I get -1 forever. Is it reading only the last character to have been sent to the socket?
As a side note, if I use readLine() (making sure the socket is sent a newline at end of msg) I can get the message fine. However, I want to be able to receive a message with 0 or many newlines in it (basically contents of a text file), so I want to avoid the readLine() method.
Any help at all is appreciated,
Colm
CODE SNIPPET:
try
serverSocket = new ServerSocket(listenToPort);
System.out.println("Server waiting for client on port " + serverSocket.getLocalPort());
while(true)
inSocket = serverSocket.accept();
System.out.println("New connection accepted " + inSocket.getInetAddress() + ":" + inSocket.getPort());
input = new BufferedReader(new InputStreamReader(inSocket.getInputStream()));
fileOutput = new BufferedWriter(new FileWriter(outputFilename));
System.out.println("Ready to write to file: " + outputFilename);
//receive each character and output it to file until file separator arrives
while(!eof)
inCharBuf = input.read();
System.out.print(inCharBuf);
//check for file separator (ASCII code 28)
if (inCharBuf == 28) eof = true;
//inChar = (char) inCharBuf;
fileOutput.write(inCharBuf);
System.out.println("Finished writing to file: " + outputFilename);
inSocket.close();
catch (IOException e)
System.out.println("IO Error with serverSocket: " + e);
System.exit(-1);
}(tabbing removed as it was messing up formatting)My guess is that the code that is writing to the
socket did not flush it. You said in one case you
could read it (via readln) if the writer was writing
lines (writeln flushes, I believe). Are you writing
the exact same data to the socket in both tests?woo hoo, I hadn't flushed the buffers alright!
for anyone with similar problems, I was missing this from my write-to-socket method:
output.flush();
where output was the BufferedWriter I had created to write to the socket.
Thanks a lot for pointing it out!
Colm -
Page order when reading an Arabic PDF
Hi everybody,
I need help with an issue I am having. When I view a book on the two -page scrolling view, the order of the pages is odd paged number is on the left and the even numbered page on the right.
When reading arabic, it is read from right to left, so this causes an issue if the smaller page number is on the left and the greater page number on the right since this would mean I have to read an arabic book which reads from right to left the same as an english book which reads from left to right.
My question is, whether I am able to change the page order of the two-page scrolling view so that the even paged numbers are on the left and the odd paged numbers on the right so it is easier to read an arabic book so it seems as if I am actually reading the book in its actual pageorder.
Any help would be appreciated.
ThanksHave a look under Edit - Preferences - Language. Make sure the RTL options are enabled.
-
How to install Unicode fonts (so I can see/read Hebrew, Arabic, Syriac)
I need to be able to see/read Hebrew, Arabic, and Syriac. I have Unicode fonts, but how are these installed on the Droid X?
Ideally, I need to also install a keyboard for these.
>(The unicode font is indeed within the software, but the proper font package is not installed to support the actual characters. Hope this helped!
-
I need program for iMac to read the arabic subtitle of movies
what is the best subtitle program for imac to read the arabic subtitle for movies ?
Hello, Are you using DVD Player, or what?
Is Arabic enabled in Languages? -
Dear Sirs,
Could anyone please help me how I could convert Unicode Character to Arabic and then display on the console (Windows XP).
For example
String alif = "\u0625";
System.out.println( alif );
ONLY PRINTS ( Question Mar) ?
Thanks in advanceThanks a lot.
I beleive that the proper answer was to inform me that this is not java related and it windows O/S related.
IF I WOULD HAVE KNOWN, TRULY AND SINCERLY, THAT THIS IS NOT JAVA RELATED I WOULD NOT HAVE COME TO THE JAVA FORUM AND ASK SUCH QUESTION.
I HAVE TESTED OTHER UNICODE CHARACTERS REGARDING OTHER LANGUAGES AND IT DISPLAYED PROPERLY. I ASKED MY SELF THERE MIGHT BE SOMETHING WRONG WITH MY CODE.
THAT IS WHY I CAME TO THE JAVA FORUM AND ASKED MY QUERY.
When I have checked the forum search, after your reply, I have seen that many people asked similar questions.
Any way thanks a lot for your help and GOD BLESS. -
Reading a string one character at a time
Hi,
I'm hoping you use SmallBasic for year 10 exam students at my school. But, I have found a problem I cannot solve.
I need to be able to read one character at a time from a string (txt file) and convert each char to its ACSII code.
How do to I read one char at a time from a string to enable processing?
Thanks for your help.
BazHere is an over the top solution that will display the Hex value of the character codes of every character in the file.
TextWindow.Write("Enter full file name: ")
filnam = TextWindow.Read()
contents = File.ReadContents(filnam) 'read the entire file
TextWindow.Clear()
TextWindow.WriteLine("File Name: " + filnam)
TextWindow.WriteLine("Offset: 0")
col = 0
row = 5
TextWindow.CursorLeft = col
TextWindow.CursorTop = row
For i= 1 To Text.GetLength(contents)
ch = Text.GetSubText(contents, i,1)
chVal = Text.GetCharacterCode(ch)
ConvertToHex()
TextWindow.CursorLeft = col
If chVal < 32 Then
TextWindow.Write(".")
Else
TextWindow.Write(ch)
EndIf
TextWindow.CursorLeft = 20 + 2 + (col * 3)
TextWindow.Write(Text.GetSubText(hexstr,1,2))
col = col + 1
If col = 8 Then
col = col + 1
EndIf
If col > 16 Then
col = 0
row = row + 1
If row > 20 then
TextWindow.CursorTop = 23
TextWindow.CursorLeft = 25
TextWindow.Write("< < < Press ENTER to Continue > > >")
TextWindow.Read()
TextWindow.Clear()
TextWindow.WriteLine("File Name: " + filnam)
TextWindow.WriteLine("Offset: " + i)
row = 5
EndIf
TextWindow.CursorTop = row
EndIf
EndFor
TextWindow.WriteLine("")
TextWindow.WriteLine("")
Sub ConvertToHex
HexValue[0] = "0"
HexValue[1] = "1"
HexValue[2] = "2"
HexValue[3] = "3"
HexValue[4] = "4"
HexValue[5] = "5"
HexValue[6] = "6"
HexValue[7] = "7"
HexValue[8] = "8"
HexValue[9] = "9"
HexValue[11] = "A"
HexValue[12] = "B"
HexValue[13] = "C"
HexValue[14] = "D"
HexValue[15] = "E"
val = chVal
hexstr = "h" 'Need to force Small basic to concatenate rather than add
While val > 0
hexPos = Math.Remainder(val, 16)
hexstr = HexValue[hexPos] + hexstr
val = Math.Floor(val / 16)
EndWhile
For hi = Text.GetLength(hexstr) To 2
hexstr = "0" + hexstr
EndFor
EndSub
Enjoy! -
Uable to read imagfile with speacial character in its NAME;from a linux box
Hi, i am facing a problem in reading a image file( file name having special character {G�stehaus}) from Linux file system.[FileNotFoundException]
I compiled my code in windows machine and run the same in Linux box.
The same file, i am able to read from a windows file system.
I think there is no problem with Linux box encoding/decoding as the file name displaying as-is.
I am expecting the problem in encoding/decoding between Java and Linux box.
Help me in solving this issue.Hi Corlettk, thanks for your immediate reply.The actual problem is with special characters [some Greek and Spanish accent characters ].
Please find some file names example below:
G�stehaus 1__154714_1157620584197.jpg
G�stehaus 2__154714_1157619047514.jpg
like this i have many...
Thanks,
Gowtham -
NI VISA read stops at zero character, returning an 0xBFFF003E error
Hi
I’m trying to read some serial data from a UUT using the NI-VISA read function. The data is mostly text but does include some control codes. The first of these appears after the ‘OK’ in the Serial Bytes window on the front panel. More text should follow but for some reason, the read function stops at the first zero character (index 144 in the Byte Array), and returns an 0xBFFF003E (-1073807298) error. I found another thread where someone had a similar problem and I’ve tried the fix for this plus a few other things, but nothing’s worked. If I use Hyperterminal, the entire data block is returned as it should be.
I wondered if this was anything to do with the 7.1 version of Labview I’m using (upgrade is on the cards). The version of NI VISA I’m running is 4.2.
Very much appreciate any thoughts.
Thanks
BruceThe error code itself is a generic VISA error which often happens with USB to RS-232 interfaces. Does your device connect to the PC through USB as a virtual COMM port? If so what chip and Windows driver is it using?
Also your function somehow looks wrong. The only criteria for the read loop to terminate is if there is an error on the VISA read or the Teststand termination status gets true. Generally if you use VISA Bytes at Serial Port you are almost always doing something wrong! That function does absolutely not synchronize with anything in your data. You will read whatever is there at that moment and that could be a partial message, no bytes at all (LabVIEW is typically many times faster than any serial device even if it is super high speed), or multiple messages.
Rolf Kalbermatter
CIT Engineering Netherlands
a division of Test & Measurement Solutions -
Reading files using wildcard character
Hi Everyone,
I currently implemented a servlet that reads contents of a specific directory using File class:
File contens = new File(directory_path);
After this I would simply call contents.list(), which would list all of the files in that particular directory. And this works fine but I need to filter some of the files out so I came up with a solution of using a wildcard character:
File contents = new File(directory_path + "SomeString" + "*");
I would assume that this should give me all of the file names that begin with "SomeString" but it does not work that well. Instead I get null trying to instantiate a new instance of a File object and NullPointerException when I try to call list() method on it.
How can I read directory contents if I want only certain file names that begin with "SomeString" for example.
Any help will be greatly appreciated!
Thanks in advance,
Y.M.You can create a FilenameFilter and use it like this:
myFilenameFilter filter=new myFilenameFilter();
String[] dirArray=new File(myPath).list(filter);
class myFilenameFilter implements FilenameFilter {
public boolean accept(File dir, String name) {
if (name.startsWith(SomeString)) return true; else return false;
}where SomeString is a globally accessible String.
V.V. -
RTL orientation on adobe reader for arabic files
How can I get reader to display arabic files so it reads right to left?
Currently it shows the pages but pages are oriented such that it reads left to rightThe direction of the text is fixed in the PDF. It is a problem with the software not doing RTL. If it makes an RTL PDF, Reader will show it.
-
Arabic Language Character Issue
Hi,
I m using oracle db 10g R2, Oracle Developer 10g & MS. Windows server 2003 R2.
I have exported a dmp file from a database base which was running on AR8MSWIN1256 database character set.
I created a new database and have imported this DMP file into database which has same platform, I have also set the NLS_LANG in windows registry as AMERICAN_AMERICA.AR8MSWIN1256, database character set as AR8MSWIN1256 database & national Character as AL16UTF16 .
I am facing a problem
when I run any Oracle report it shows unusual characters like Italian or german in the report.
However, When I save the data through the oracle Forms it allows to save & retrieve in Arabic(Egyptian).
But It shows unusual result in report
How do I solve this problem.
Regards,
Suhaib
Edited by: suhaib ahmed on Apr 3, 2010 5:05 PM
Edited by: suhaib ahmed on Apr 3, 2010 5:05 PMTo be honest I'm not familiar with the Developer Suite. You already posted this issue in Developer Tools forum, I recommend you do the same in this forum:
Globalization Support
This Globalization forum is even monitored by an Oracle expert.
Werner -
Arabic punctuation when exporting to ePUB fixed layout
Hello,
I'm using InDesign CC6 ME and on it my document looks just fine.
Once I try export to ePUB 3.0 fixed layout, my end-of-paragraph punctuation shows up at the beginning of the last line instead of at the end.
Please keep in mind that since this is an Arabic text, the punctuation at the end of the line has to be at the far left which is not what I'm getting.
I hope I can find some help with this.Hi Sania:
Pooja is absolutely correct.
There are a variety of limitations at this point in Roman/J/ME which we have been working to improve with our aim being that update-to-update to InDesign CC for both Reflowable and Fixed Layout we keep getting better. We've been focusing on Roman first and have had our hands full with that.
The team as benefited immensely by being able to work with real customer customer document - would you be willing to share some of yours with us? We only use them for our own internal testing and do not share them outside of Adobe (and typically only the team). It makes a big difference to us.
If so, please contact Pooja directly at [email protected] and she will make arrangements for receiving them. Typically we just need you to package the document (or a subset of it, whatever you feel comfortable with) so we get the necessary assets and fonts.
Help us make this better.
Douglas Waterfall
Architect, InDesign Engineering -
In Reader X, printing one character off
View of the doc is fine but intermittently starts printing one character off after 1 or 2 pages of good print.
Are you printing the PDF file from a web browser? Have you tried to Print PDF as image in the Reader print dialog?
Maybe you are looking for
-
Kernel Panic After Security Update Reboot
My nearly new 24" iMac had a kernel attack after a Apple software multi-update, including a security item, ...rebooting into Darwin. I've run Disc Utility from the install disc and verified and repaired permissions, rebooted in safe mode, back to Dar
-
Is there a way to accomplish a dynamic image insertion linkage?
I have a cell in my spreadsheet where I have inserted a graphic, let's say .../GRAPHICS/PICTURE-1.JPG for reference. I would like the image displayed in Numbers to change dynamically by virtue of my changing the contents of .../GRAPHICS/PICTURE-1.JPG
-
Can't see MFP printer attached to AE (in Bridge mode)
Can't see MFP printer attached via ethernet cable to 2nd AE (in Bridge mode extending wireless network) on local wifi network. Printer is set to static IP adress (192.168.0.50). Upstream Router is: 192.168.0.1 (this is connected to first AE). When th
-
Can i get a blue ray drive on my HP dv6 1233eo?
Hey everyone title says it all i have a hp dv6 1233eo and i use it for a lot of media watching movies and playing games and i would could use a blueray disc drive but im not so good whit hardware and stuff so can anny of you please tell me if this is
-
Songs getting truncated on mini
Ever since I've had this mini, it's wanted to truncate certain songs by chopping off the last 20 seconds of music or so. I keep updating iTunes to no avail. Latest version does it too. Once when I lost everything on my iPod, I had to re-install from