He must have known that before he ordered the charge.
Have you read Lee's Lieutenants, by Douglas Southall Freeman?
Great analysis of Lee's Generals. Freeman also says the Longstreet failed Lee miserably at Gettysburg.
Whoa fellow, hold your horses! ;-)
Everybody remembers that Lee ordered "Pickett's Charge" on July 3. Apparently nobody remembers that he ordered two other assaults on that same day, which would have turned the battle in his favor, had they succeeded.
Ewell's Second Corps was ordered to again attack Culp's Hill in the north. Success would have given him a commanding position behind and above Cemetery Ridge.
At the same time, Stuart's cavalry was ordered to ride around Ewell's left and attack Meade from the rear. Now remember, Stuart's cavalry division was about half the strength of Ewell's or Longstreet's corps.
Additionally, Longstreet had forces in reserve to reinforce "Pickett's Charge," but were never sent.
Point is this: at the same time the Pickett and Pettigrew DIVISIONS attacked Cemetery Ridge from the front, Ewell & Stuart -- a CORPS and a HALF -- were to attack from the flank and rear. On July 3, Lee had every reason to believe those COMBINED efforts would crack the Union army and crumble its lines. Then Longstreet would send in mop-up forces.
In fact, of course, all three assaults failed, while Longstreet sulked, for reasons that Lee could not know. Stuart's cavalry was just too exhausted to put up their usual vigorous fight. Culp's Hill was too well defended against Ewell's assault. Alexander's artillery overshot and missed the Union forces defending Cemetery Ridge.
In short, Lee had a larger plan, which he believed would succeed. It did not, and Lee is to blame, but not solely to blame.