This paper describes an empirically derived algorithm to compensate for charge trapping in CdTe, CdZnTe, and other planar semiconductor detectors. The method is demonstrated to be an improvement over available systems and application to experimental data is shown