diff --git a/PKHeX.Core/Editing/CommonEdits.cs b/PKHeX.Core/Editing/CommonEdits.cs
index a7a12539c..f8ffade9c 100644
--- a/PKHeX.Core/Editing/CommonEdits.cs
+++ b/PKHeX.Core/Editing/CommonEdits.cs
@@ -30,8 +30,10 @@ public void SetNickname(string nick)
pk.ClearNickname();
return;
}
- pk.IsNicknamed = true;
+
+ pk.PrepareNickname();
pk.Nickname = nick;
+ pk.IsNicknamed = true;
}
///
diff --git a/PKHeX.Core/Legality/RNG/Methods/Gen9/GenerateParam9.cs b/PKHeX.Core/Legality/RNG/Methods/Gen9/GenerateParam9.cs
index 1d191f097..3e4f16043 100644
--- a/PKHeX.Core/Legality/RNG/Methods/Gen9/GenerateParam9.cs
+++ b/PKHeX.Core/Legality/RNG/Methods/Gen9/GenerateParam9.cs
@@ -4,7 +4,7 @@ namespace PKHeX.Core;
/// Parameters used to generate data for an encounter.
///
/// Species to generate.
-/// Gender ratio byte.
+/// Gender ratio byte from Personal Info.
/// Count of IVs that are perfect.
/// Count of shiny rolls allowed for the PID calculation.
/// Height value to generate. If zero, full random.
diff --git a/PKHeX.Core/Legality/Verifiers/Misc/MiscVerifierG3.cs b/PKHeX.Core/Legality/Verifiers/Misc/MiscVerifierG3.cs
index 0edae4e67..d6f4f062d 100644
--- a/PKHeX.Core/Legality/Verifiers/Misc/MiscVerifierG3.cs
+++ b/PKHeX.Core/Legality/Verifiers/Misc/MiscVerifierG3.cs
@@ -135,9 +135,9 @@ private static void FlagIsNicknameClean(LegalityAnalysis data, PK3 pk)
{
if (!pk.IsNicknamed || pk.IsEgg)
return;
- var nick = pk.NicknameTrash;
- if (pk.Japanese)
- nick = nick[..5]; // Japanese only wipes the first 5 bytes; everything else is trash.
+ // Japanese only fills the first 5+1 bytes; everything else is trash.
+ // International games are 10 chars (full buffer) max; implicit terminator if full.
+ var nick = pk.GetNicknamePrefillRegion();
if (!TrashByteRules3.IsTerminatedFF(nick))
data.AddLine(GetInvalid(Trainer, TrashBytesMismatchInitial));
}
diff --git a/PKHeX.Core/PKM/PK3.cs b/PKHeX.Core/PKM/PK3.cs
index 578ab6793..e36b551d4 100644
--- a/PKHeX.Core/PKM/PK3.cs
+++ b/PKHeX.Core/PKM/PK3.cs
@@ -398,4 +398,15 @@ public override int GetStringTerminatorIndex(ReadOnlySpan data)
public override int GetStringLength(ReadOnlySpan data)
=> TrashBytes8.GetStringLength(data);
public override int GetBytesPerChar() => 1;
+
+ public override void PrepareNickname() => GetNicknamePrefillRegion().Fill(StringConverter3.TerminatorByte);
+
+ public Span GetNicknamePrefillRegion()
+ {
+ // Japanese only fills the first 5+1 bytes; everything else is trash.
+ // International games are 10 chars (full buffer) max; implicit terminator if full.
+ if (Japanese)
+ return NicknameTrash[..6];
+ return NicknameTrash;
+ }
}
diff --git a/PKHeX.Core/PKM/PKM.cs b/PKHeX.Core/PKM/PKM.cs
index 612ba34d3..0d538c050 100644
--- a/PKHeX.Core/PKM/PKM.cs
+++ b/PKHeX.Core/PKM/PKM.cs
@@ -44,6 +44,11 @@ public abstract class PKM : ISpeciesForm, ITrainerID32, IGeneration, IShiny, ILa
public abstract Span OriginalTrainerTrash { get; }
public virtual Span HandlingTrainerTrash => [];
+ ///
+ /// Conditions the data to safely terminate the Nickname string from the text entry screen.
+ ///
+ public virtual void PrepareNickname() { }
+
protected abstract byte[] Encrypt();
public abstract EntityContext Context { get; }
public byte Format => Context.Generation;