From: h677 Date: Sun, 26 Feb 2006 04:12:03 +0000 (+0000) Subject: <>の直前にShiftJISの1byte目がいるとパースできない不具合の修正 X-Git-Tag: v1_64_1_820~441 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=e44698555e7a8b55a641562b89dbb028e028e081;p=gikonavigoeson%2Fgikonavi.git <>の直前にShiftJISの1byte目がいるとパースできない不具合の修正 --- diff --git a/MojuUtils.pas b/MojuUtils.pas index 71fbd9c..fe4aa58 100644 --- a/MojuUtils.pas +++ b/MojuUtils.pas @@ -103,10 +103,10 @@ begin Result := StrPosEx(StrStart, StrEnd, SubstrStart, SubstrEnd); while (Result <> nil) and (StrEnd - Result >= L2) do begin - ByteType := StrByteType(StrStart, Integer(Result-StrStart)); - if (ByteType <> mbTrailByte) and - (CompareString(LOCALE_USER_DEFAULT, SORT_STRINGSORT, Result, L2, SubstrStart, L2) = 2) - then Exit; + ByteType := StrByteType(StrStart, Integer(Result-StrStart)); + if (ByteType <> mbTrailByte) and + (CompareString(LOCALE_USER_DEFAULT, SORT_STRINGSORT, Result, L2, SubstrStart, L2) = 2) + then Exit; if (ByteType = mbLeadByte) then Inc(Result); Inc(Result); Result := StrPosEx(Result, StrEnd, SubStrStart, SubStrEnd); @@ -352,16 +352,21 @@ begin pds := PChar(delimiter); pde := pds + Length(delimiter); - pos := AnsiStrPosEx(pss, pse, pds, pde); + pos := StrPosEx(pss, pse, pds, pde); if pos <> nil then begin p := pos - pss; SetString(Result, pss, p); Delete(s, 1, p + Length(delimiter)); + + if (StrByteType(PChar(Result), Length(Result)-1) = mbLeadByte) then begin + SetLength(Result, Length(Result) - 1); + end; end else begin Result := s; s := ''; end; end; + //! –³ŠQ‰»(& -> & " -> &auot; ‚É•ÏŠ·‚·‚é) function Sanitize(const s: String): String; begin