cancel
Showing results for 
Search instead for 
Did you mean: 

Deleting Null Character with Hexa value HEX '00'

Former Member
0 Kudos

Hi File file has data like this

  1. Shown in File is Hexa value HEX '00'

In Actual file there is Null character in place of #,but when we tranfer file on to FTP it is showing as below.

So i have to actually remove Null character .

#{#-###

#S#C#H#N#F#R#2#2###

#M#I#D#D#G#B#P#P###

#1#0#1###

#:#2#0#:#X#1#0#1#0#6#6#0#8#0#0#5#7#8#2#0###

#:#2#1#R#:#0#0#0#0#0#5#7#9#2#1###

#:#2#8#D#:#1#/#1###

#:#5#0#H#:#/#G#B#1#4#M#I#D#D#1#2#3#4#5#6#0#0#1#2#7#6#6#5###

#T#E#S#T###N#A#M#E###1###

#T#E#S#T###N#A#M#E###2###

#T#E#S#T###S#T#R#E#E#T###

#T#E#S#T#####C#I#T#Y###

#:#5#2#A#:#M#I#D#D#G#B#P#P###

#:#3#0#:#0#8#0#2#1#8###

#:#2#5#:#E#B#P#7#2#6#2###

###

#:#2#1#:#X#1#0#1#0#6#6#0#8#0#0#5#7#8#2#0###

#:#2#3#E#:#U#R#G#P###

#:#3#2#B#:#G#B#P#6#2#4#0#1#,#3#2###

#:#5#0#H#:#/#G#B#1#4#M#I#D#D#1#2#3#4#5#6#0#0#1#2#7#6#6#5###

#T#E#S#T###N#A#M#E###1###

#T#E#S#T###N#A#M#E###2###

#T#E#S#T###S#T#R#E#E#T###

#T#E#S#T#####C#I#T#Y###

#:#5#2#A#:#M#I#D#D#G#B#P#P###

#:#5#7#A#:#C#P#B#K#G#B#2#1#L#E#W###

Please suggest..

Accepted Solutions (0)

Answers (2)

Answers (2)

stefan_grube
Active Contributor
0 Kudos

Could this be UTF-16?

Then you could apply the code page UTF-16 in the file adapter channel. The file will be transfered to UTF-8

Regards

Stefab

Former Member
0 Kudos

Apply a Java Mapping Program as a first Mapping Program.

The following is the sample code I used to change & to &

Liang


package YourPackage;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Map;
 
import org.w3c.dom.Document;

import com.sap.aii.mapping.api.StreamTransformation;

/**
 * @author user
 *
 * To change the template for this generated type comment go to
 * Window>Preferences>Java>Code Generation>Code and Comments
 */
public class RemoveAmpsand implements StreamTransformation {
 
	private Map map;
	private Document document;
 
	/**
	 * method setParamters is required, but we do not anything with it
	 */
	public void setParameter(Map param) {
		map = param;
	}
 
	/**
	 * method execute is called by the XI mapping program
	 */
	public void execute(InputStream in, OutputStream out){
		try {
		int c;
		while ((c = in.read()) != -1) {
		if (c != '&') {
		out.write(c);
		} else {
//		   ampersand
		out.write("&".getBytes());
		}
		} // while
		out.flush();
		} catch (Exception e) {
		//throw new StreamTransformationException(e.getMessage(),e);
		
		}
 
	}


}