Convert a text (unicode) in Binary
Dear Guys ,
I have the following issue :
I must read a file (xxx.dat) that contains the following data : P+ 00100
I want to read it in binary mode and then to put it in a string and work it.
In Non unicode systems i did it and worked fine .
I was using the WS_UPLOAD with 'BIN'
Now that i have Unicode system i can't transfer it in string ...
I use :
OPEN DATASET XFILENAME FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF SY-SUBRC = 0.
READ DATASET XFILENAME INTO FDATA-LINE.
ENDIF.
CLOSE DATASET XFILENAME.
P+ 00100 (bin:502be.................)
I want to put the 502be...... to string .
Hope this helps
import java.io.*;
public class Copy {
public static void main(String[] args) throws IOException {
File inputFile = new File("farrago.txt");
File outputFile = new File("outagain.txt");
FileReader in = new FileReader(inputFile);
FileWriter out = new FileWriter(outputFile);
BufferedReader buff = new BufferedReader(in);
String c;
while ((c = buff.readLine()) != null)
out.write(c.toUpperCase());
in.close();
out.close();
}
Similar Messages
-
Open data set from Text mode to Binary mode
Hello All,
In a program i am using the command
OPEN DATASET file FOR OUTPUT IN TEXT MODE
ENCODING NON-UNICODE IGNORING CONVERSION ERRORS.
Now i want to change this open data set to binary mode. I mean to change the command like below.
OPEN DATASET file FOR OUTPUT IN BINARY MODE.
when i do this. the output in the file is totally changing. I mean previously i have some text now i have some diffrent characters.
How can i use this command with out change in the output as previous output. Please tell me the changes and why i have to do.
OPEN DATASET file FOR OUTPUT IN BINARY MODE.
Regards,
Lisa.
Message was edited by:
Lisa RoyText Mode means that the records in the file have a carriage return marking the end of each record.
Binary Mode means the file is a string of data.
You can't read a text file in BINARY MODE, or a binary file in TEXT MODE.
If you are changing the mode, then you must be supplied with a file in the new mode. -
What is difference between TEXT mode and BINARY mode?
Hi,
What is difference between TEXT mode and BINARY mode? In TEXT mode what is "ENCODING DEFAULT".
OPEN DATASET wl_filename FOR INPUT
IN TEXT MODE ENCODING DEFAULT.
OPEN DATASET wl_filename FOR INPUT
IN BINARY MODE .Hi vishnu,
1. files like .TXT files are considered to be text,
and other files like .EXE . DOC etc are binary files.
2. In text files, after each line, there are two
internal binary characters
one for line feed and another one for newline.
3. But, we don't have any meaning for it,
when we view such files in notepad, for eg.
Hence, to only get the understandable content,
we should open such TXT files, in text mode.
(we can also open them in binary mode,
but we will get two extra characters after each line,
and such two extra characters are meaningless
for interpreting the text)
4. In binary mode, each byte by byte is considered,
without any meaning.
regards,
amit m. -
Need to convert all text frames to intinal caps.
Hi All,
I need to convert all text frames in the eps files the text should be first letter to be caps.
EXAMPLE:
" The Example Text In The Discussion" to be " The example text in the discussion "
I am manually converting around 350 Eps files daily,
Any help!!!
regards,
VinothHi Larry,
Thanks for the reply.
Yes, excatly we do manually by Type>Change Case>Sentence Case
But i need this to be done in scripting. My Knowledge in scripting is not good.
Could you please help me regarding this issue.
regards,
Vinoth -
SSRS report - A single selection dropdown list converted to text box
Hello everyone,
We created a single selection dropdown parameter (City parameter) on a report. The data in this parameter is populated using MDX query. Also, it is filtered based on selection of another single selection dropdown list (Country parameter) of a report.
The problem is when there is no cities for the selected country the dropdown list is gets converted to free type text box and user can insert city data in it. Why SSRS is not keeping it as empty dropdown list with no data?
Any help would be much appreciated.
Thanks, Ankit Shah
Inkey Solutions, India.
Microsoft Certified Business Management Solutions Professionals
http://www.inkeysolutions.com/MicrosoftDynamicsCRM.htmlHello Charlie,
We developed a fresh report only with two parameters but still the dropdown control gets converted to text box in our case. We have two single selection parameters, Location and Customers. Based on selected Location the customer
dropdown gets populated.
Location Parameter Query
WITH MEMBER [Measures].[ParameterCaption] AS [Location].[Location Name].CURRENTMEMBER.MEMBER_CAPTION MEMBER [Measures].[ParameterValue] AS [Location].[Location Name].CURRENTMEMBER.UNIQUENAME MEMBER
[Measures].[ParameterLevel] AS [Location].[Location Name].CURRENTMEMBER.LEVEL.ORDINAL
SELECT {[Measures].[ParameterCaption], [Measures].[ParameterValue], [Measures].[ParameterLevel]} ON COLUMNS , [Location].[Location Name].ALLMEMBERS ON ROWS FROM [Model]
Customer Query
WITH MEMBER [Measures].[ParameterCaption] AS
[Customer].[Customer Name].CURRENTMEMBER.MEMBER_CAPTION
MEMBER [Measures].[ParameterValue] AS
[Customer].[Customer Name].CURRENTMEMBER.UNIQUENAME
MEMBER [Measures].[ParameterLevel] AS [Customer].[Customer Name].CURRENTMEMBER.LEVEL.ORDINAL
SELECT {[Measures].[ParameterCaption], [Measures].[ParameterValue], [Measures].[ParameterLevel],[Measures].[Amt]} ON COLUMNS,
nonempty([Customer].[Customer Name].ALLMEMBERS,[Measures].[Amt]) ON ROWS FROM ( SELECT ( STRTOSET(@LocationName, CONSTRAINED) ) ON COLUMNS FROM [Model])
Regarding parameter settings on General tab for both the above parameters we did not select any of the following values, all these checkboxes are empty:
Allow Blank Value ("") , Allow null value, Allow multiple values.
I think it has something related to [Measures].[Amt] that we used in customer parameter. We are now trying to take other two parameters where we would be not using the [Measures].[Amt] to filter the data. Will update you soon.
Thanks, Ankit Shah
Inkey Solutions, India.
Microsoft Certified Business Management Solutions Professionals
http://www.inkeysolutions.com/MicrosoftDynamicsCRM.html -
Converting a text file into a String
I need to convert a text file (in whatever format, in my case it would be xml and xsl files) in a String.
I made this methods:
public static String createStringFromFile(File f) {
StringBuffer buf = new StringBuffer();
try {
FileInputStream fInp = new FileInputStream(f);
byte[] byteArray = new byte[fInp.available()];
int bLetti = fInp.read(byteArray);
if (bLetti == fInp.available()) {
for (int i=0; i<fInp.available(); i++)
buf.append(Byte.toString(byteArray));
else
throw (new IOException("Errore nella lettura del file"));
fInp.close();
} catch (Exception e) {
ErrorManager.getError(e);
return (buf.toString());
public static String createStringFromFile(String fileName) {
StringBuffer buf = new StringBuffer();
try {
FileInputStream fInp = new FileInputStream(fileName);
byte[] byteArray = new byte[fInp.available()];
int bLetti = fInp.read(byteArray);
if (bLetti == fInp.available()) {
for (int i=0; i<fInp.available(); i++)
buf.append(Byte.toString(byteArray[i]));
else
throw (new IOException("Errore nella lettura del file"));
fInp.close();
} catch (Exception e) {
ErrorManager.getError(e);
return (buf.toString());
There are no compilation or runtime errors, but the result string is empty. Not null, empty. What should I do? :)Do you really want to use bytes and so on when java does it all for you?
Here's how I did it, hope it's useful.
public String getFileAsString(String fileName){
StringBuffer buffer = new StringBuffer();
try{
BufferedReader bRead = new BufferedReader(new FileReader(new File(fileName)));
String str = "";
while( (str = bRead.readLine()) != null ){
buffer.append(str);
}//end while
bRead.close();
}catch(Exception e){
System.err.println("in getFileAsString(): " + e.toString());
}//end try
return buffer.toString();
}//end getAsString() -
Setting Font for converting multiple text files into PDF using VB 6.0
Dear All,
Am converting multiple text files into PDF using VB6.0. Currently, am unable to control the font face and size for the generated files. Below is the procedure am using for each file;
Public Sub proc_convert_to_PDF(srcFilename As String, destFilename As String)
Dim p_AcroApp As CAcroApp
Dim p_VDoc As CAcroAVDoc
Dim p_DDoc As CAcroPDDoc
Dim IsOk As Boolean
Set p_AcroApp = CreateObject("AcroExch.App")
Set p_VDoc = CreateObject("AcroExch.AVDoc")
Call p_VDoc.Open(srcFilename, "")
Set p_VDoc = p_AcroApp.GetActiveDoc
If p_VDoc.IsValid Then
Set p_DDoc = p_VDoc.GetPDDoc
' Fill in pdf properties.
p_DDoc.SetInfo "Title", Format(Date, "dd-mm-yyy")
p_DDoc.SetInfo "Subject", srcFilename
If p_DDoc.Save(1 Or 4 Or 32, destFilename) <> True Then
MsgBox "Failed to save " & srcFilename
End If
p_DDoc.Close
End If
'Close the PDF
p_VDoc.Close True
p_AcroApp.Exit
'Clear Variables
Set p_DDoc = Nothing
Set p_VDoc = Nothing
Set p_AcroApp = Nothing
End Sub
What I need;
1) to be able to set the font face of the destination file ( destFilename)
2) to be able to set the font size of the destination file ( destFilename)
Am using Adobe Acrobat 7.0 Type Library
Kindly Help.
Thanks in advanceWe didn't say it doesn't work. We said it isn't supported.
There are a number of other ways to make a PDF. The one which would
give the most control is if your application directly printed to GDI,
controlling the font directly. This could print to Adobe PDF.
You could look for an application that gives control of font for
printing.
You could use a text-to-PostScript system and distill the result. You
could even look for a non-Adobe text-to-PDF.
Working in the unsupported and dangerous world you chose, the font
size for text conversion is set (and this is very bad design from
Adobe) in the settings for Create PDF > From Web Page. There is no API
to this.
Aandi Inston -
Problem in converting english text to arabic text in Acrobat XI professional
Hi,
One of our client is facing issue while converting english text to arabic text in Acrobat XI professional. Can somebody help me to find a solution for this.Ok , that is clear the customer has another query. He is trying to convert a pdf Arabic file into word formate but it is showing arabic font which is not in a proper form.i am attaching the print screen .
-
About converting a text member to a list
Hi there everyone!
I'm trying to convert a prepared text member to a property
list.
the text cast member:
[#boxes:[#b0: [#rect: rect(61, 392, 695,
465)],#b1:[#rect:rect(501,358,688,460)],#b3:[#rect:rect(99,415,199,493)]],#points:[#p0:[# loc:point(677,428)],#p1:[#loc:point(92,397)]]
the code I tried:
a = member("walkable").text
dWalkable = value(a)
put dWalkable
but the result is always : <VOID>
how can I convert the text cast member to a property list?The reason you are getting void is because after converting
it from a
string, what you have left is not a properly formatted list.
I think
you just need to add a closing square bracket at the end and
then it
should work. -
How do I convert a text, word or photo into a pdf doc?
How do I convert a text, word or photo to a pdf coc for E-Mail?
Install Acrobat XI (Standard or Pro).
Use Acrobat's create PDF feature for supported file formats (TXT, RTF, DOC, DOCX, JPEG, TIFF and others are supported).
Use the installed Adobe PDF virtual printer to "print" a PDF from any application that can print to an installed printer.
Be well... -
How to convert the text field into currency field
Hi,
I have an requirement to converting the text field into currency.
If I convert directly it gives dump.
If I convert this to Numeric means it takes the decimals also as whole value.
Is there any FM to convert the text field into Currency field.
Please advice me.
Thanks in advance.Hi,
I am on an SRM sytem, which unfortunately does not have th FM: PSSV_TEXT_INTO_FIELD_CURRENCY.
But I also need to transfer a string value like '12,99' to a field with type curr.
Can i Do that manually, or is there another FM?
I have already checked code with write to or pack/unpack.
But without success yet.
Something like this:
DATA: g_str(11) type c.
DATA: g_p type p.
WRITE '12,99' TO g_str CURRENCY 'EUR'.
is no use for me. Finally I need to move g_str to my curr-field, which causes st22.
also: PACK g_str to <curr-field or g_p> dumps.
Help appreciated.
regards, matthias -
How to convert a "text variable" to String with plugin
Hello,
I am currently developing a InDesign (CS5) plugin, where I need to manipulate text variable.
From the plugin I want to convert the "text variable" to string (in principle I should use the method "VariableToString (..)" of "ITextVariable")"
My problem is, how to find the text varial from its name (I think I should use the method "FindLocationsUsed(..)" of "ITextVariableSuite") and then convert it to String
I don't know how to use interfaces ITextVariable and ITextVariableSuite
Plugin implemented in C++ language
thank youInputStreamReader in=new InputStreamReader(fis);
StringWriter out=new StringWriter();
char[] buffer=new char[8192];
int sizeRead;
while ( ( sizeRead=in.read(buffer, 0, 8192) ) != -1 )
out.write(buffer, 0, sizeRead);
String content=out.toString(); -
How to convert the TEXT file into an XML using plsql code
Hi all ,
I need to convert an TEXT file into an XML file how can i do it
Below is my sample TEXT file .
TDETL00000000020000000000000120131021115854ST2225SKU77598059 0023-000000010000
I want the above to be converted into the below format
<?xml version="1.0" encoding="UTF-8"?>
<txt2xml>
<!-- Processor splits text into lines -->
<processor type="RegexDelimited">
<regex>\n</regex>
<!--
This is used to specify that a message should be created per line in
the incoming file;
NOTE: this was designed to work with all the processors, however it
only works correctly with 'RegexDelimited' processors (check the
enclosing top processor type)
-->
<maxIterationsPerMsg>1</maxIterationsPerMsg>
<!-- For lines beginning with FHEAD (File Header) -->
<processor type="RegexMatch">
<element>FHEAD</element>
<regex>^FHEAD(.*)</regex>
<processor type="RegexMatch">
<element>OriginalLine</element>
<regex>(.*)</regex>
<consumeMatchedChars>false</consumeMatchedChars>
</processor>
<processor type="RegexMatch">
<element>LineSeq,Type,Date</element>
<regex>^(\d{10})(\w{4})(\d{14})$</regex>
</processor>
</processor>
<!-- For lines beginning with TDETL (Transaction Details) -->
<processor type="RegexMatch">
<element>TDETL</element>
<regex>^TDETL(.*)</regex>
<processor type="RegexMatch">
<element>OriginalLine</element>
<regex>(.*)</regex>
<consumeMatchedChars>false</consumeMatchedChars>
</processor>
<processor type="RegexMatch">
<element>LineSeq,TransControlNumber,TransDate,LocationType,Location,ItemType,Item,UPCSupplement,InventoryStatus,AdjustReason,AdjustSign,AdjustQty</element>
<regex>^(\d{10})(\d{14})(\d{14})(\w{2})(\d{4})(\w{3})([\w ]{13})([\w ]{5})(\d{2})(\d{2})([+-]{1})(\d{12})$</regex>
</processor>
</processor>
<!-- For lines beginning with FTAIL (File Tail) -->
<processor type="RegexMatch">
<element>FTAIL</element>
<regex>^FTAIL(.*)</regex>
<processor type="RegexMatch">
<element>OriginalLine</element>
<regex>(.*)</regex>
<consumeMatchedChars>false</consumeMatchedChars>
</processor>
<processor type="RegexMatch">
<element>LineSeq,TransCount</element>
<regex>^(\d{10})(\d{6})$</regex>
</processor>
</processor>
</processor>
</txt2xml>
ThanksSorry, that doesn't make much sense.
The XML you gave is a configuration file for txt2xml utility. It doesn't represent the output format.
Are you a user of this utility? -
Does Illustrator do a good job of converting PDF text to text entities in DWG?
My company receives a lot of drawings in PDF format. They look great, but when we're asked to modify these drawings, they have to be redrawn in CAD. This is very time-consuming and costly. I would like to use Illustrator to convert these PDFs to DWG format. I've found products that will convert the linework and other content of the drawing; however, none that I've found can convert the text in the PDF to text entities in the DWG.
I would install the free trial version if Adobe Illustrator, but I can't. My company is currently using Windows XP operating system. Illustrator requires Windows 7 or 8.I don't think you'd be happy with any conversion of text between Illustrator and DWG. Text handling differs greatly in the respective editing environments. I may have missed something, but I've never seen usable text going in either direction, either to or from DWG.
-
Conversion from .pdf to .docx:
I have converted a text in Slovenian in .pdf, but all the accents are missing in the converted .docx. version.
Does Adobe have a converter for texts with European-language accents, or shall I cancel my subscription?Subscription for what: ExportPDF or Acrobat?
[topic moved to Acrobat.com Services forum]
Maybe you are looking for
-
How to change the ownership of a doc after a specific time in workflow ?
Hi My objective is to create a workflow in ESO , that will change the ownership of a contract document from the current person to his supervisor ( supervisor's id will be in user id management page) after a specific time . Please help me how to do it
-
Where can I download adobe acrobat professional version 7.0 for mac
thanks!
-
ICal crashing after iOS4 update
Since updating my iPhone 3G to iOS4 last week I have been unable to use iCal. It crashes about 10 seconds after opening. I have tried resetting the sync data and also have tried unselecting calendar syncing in .mac prefs but this has not worked. I ha
-
Can't open illustration. This illustration contains an illegal operand
I opened a file i was working on for some days now, and i got this MSG?? Can't open illustration. This illustration contains an illegal operand. ((( /Real (xmlnode-nodevalue) , %_(width) /String (xmlnode-nodename) , %_; (width) , %_/XMLNode : %_/Dict
-
BOFC MS SQL Server migration to Oracle
Hello, We use BOFC, Intercompany with MS SQL Server 2008 R2 DB. Customer asks us about possibility migration MS SQL Server 2008 R2 to Oracle 11g. I didn't find any information in SMP, lot of information about migration NW systems, but no information